home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / remcmd.zip / REMCMDC4.CMD < prev    next >
OS/2 REXX Batch file  |  1993-05-10  |  2KB  |  64 lines

  1. /* Rexx */
  2.  
  3. /* Read from a pipe and send it out over APPC */
  4.  
  5. Parse Arg partlu, partmode, hread, hwrite
  6.  
  7. appcrc = Appc('Tp_Started', , 'REMCMDC4', 'inf.')
  8. If appcrc <> 0 Then
  9.   Do
  10.   Say 'Tp_Started failed with rc='xlatrxap(appcrc)'.'
  11.   Exit
  12.   End
  13. tpid = inf.0
  14. Signal On Syntax Name Trap_Allocate_Syntax
  15. appcrc = Appc('Allocate',tpid,partlu,partmode,'REMCMDC2','Mapped',
  16.               , 'A','N','None','Inf.')
  17. Signal Off Syntax
  18. If appcrc <> 0 Then
  19.   Do
  20.   say 'Mc_Allocate failed with rc='xlatrxap(appcrc)
  21.   say 'Primary Rc  ='c2x(inf.2);
  22.   say 'Secondary Rc='c2x(inf.3)
  23.   say 'Sense Code  ='c2x(inf.4)
  24.   Call Appc 'Tp_Ended', tpid
  25.   Exit
  26.   End
  27. convid = inf.1
  28.  
  29. call rxsi2h hread
  30. Do Forever
  31.   line = linein()
  32.   If line = '' Then
  33.     line = ' '
  34.   appcrc = Appc('Send_Data', tpid, convid, 'Mapped', cryption(line))
  35.   If appcrc <> 0 Then
  36.     Do
  37.     Say 'Send_Data failed with rc='xlatrxap(appcrc)'.'
  38.     Call Appc 'Tp_Ended', tpid
  39.     Exit
  40.     End
  41.   appcrc = Appc('Flush', tpid, convid, 'Mapped')
  42.   If appcrc <> 0 Then
  43.     Do
  44.     Say 'Flush failed with rc='xlatrxap(appcrc)'.'
  45.     Call Appc 'Tp_Ended', tpid
  46.     Exit
  47.     End
  48. End
  49.  
  50. call rxdestroypipe hread, hwrite
  51. Call Appc 'Deallocate', tpid, convid, 'Mapped', 'Sync_Level'
  52. Call Appc 'Tp_Ended', tpid
  53.  
  54. Exit
  55.  
  56. Syntax:
  57. Say 'Command "'cmdstr'"'
  58. Say 'Failed with syntax error ('rc')' ErrorText(rc)
  59. Call Respond_To_Partner
  60. Signal Restart_From_Here
  61.  
  62. Cryption:
  63. Return BitXor(Arg(1),Copies('ff'x,Length(Arg(1))))
  64.