home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff330.lzh / Vt100 / RexxSamples / Forward.rexx next >
OS/2 REXX Batch file  |  1990-03-02  |  893b  |  46 lines

  1. /*   An AREXX macro to demonstrate the FORWARD command and its use.  It will
  2. ** open a port and request VT100 to forward received data to this port.  It
  3. ** will then await 3 messages from VT100 (3 batches of data) and then will ask
  4. ** VT100 to quit forwarding received data, close the port and exit.
  5. **/
  6.  
  7. trace R
  8.  
  9. address VT100-serial.device-00
  10.  
  11. if show("L", "rexxsupport.library") = 0
  12. then call addlib "rexxsupport.library", 0, -30, 0
  13.  
  14. portname = "REXX-VT100"
  15. port = openport(portname)
  16.  
  17. if Port = '0000 0000'x
  18. then do
  19.     say "Couldn't open the port."
  20.     exit 20
  21. end
  22.  
  23. "FORWARD" portname
  24.  
  25. do i = 1 to 3
  26.     packet = getpkt(portname)
  27.     if packet = '0000 0000'x
  28.     then do
  29.         call waitpkt portname
  30.         packet = getpkt(portname)
  31.     end
  32.     call reply packet, 0
  33. end
  34.  
  35. 'FORWARD'
  36.  
  37. packet = getpkt(portname)
  38. do while packet ~= '0000 0000'x
  39.     call reply packet, 0
  40.     packet = getpkt(portname)
  41. end
  42.  
  43. call closeport port
  44.  
  45. exit
  46.