home *** CD-ROM | disk | FTP | other *** search
/ ANews 1 / AnewsCD01.iso / Internet / FTP / AmFTP / Rexx / send.rexx < prev   
OS/2 REXX Batch file  |  1999-08-11  |  2KB  |  68 lines

  1. /*
  2.  
  3. AmFTP Rexx-Port Example Script, receive.rexx
  4.  
  5. Copyright © 1995-1996 by Mathias Mischler, All Rights Reserved.
  6.  
  7. This script was written to show the use of the AmFTP Rexx Port,
  8. because the is a major AmFTP-Rexx problem: AmFTP is a asyncronious
  9. program, so we _can't_ just start a command and than next one.
  10.  
  11. Solution: What we have to do, is to _initiate_ a command, wait until
  12. command is ready and than initiate next one (wait for this...).
  13.  
  14. AmFTP provides following functions to easy handle this:
  15.  
  16. INACTION:
  17. INACTION returns 0 when AmFTP is free to get new commands.
  18.          returns 1 when AmFTP is busy on working.
  19.  
  20. WAITACTION PORT:
  21. WAITACTION tells AmFTP to send a message to a specified MessagePort
  22. when it is ready with last command. So you can just do a WAITPKT.
  23. This example shows how to wait on such messages. We need to open
  24. rexxsupport.library to use 
  25. OPENPORT to create a MessagePort,
  26. CLOSEPORT to close a MessagePort and
  27. WAITPKT to wait for a message from AmFTP.
  28. (See also rexx.guide OPENPORT, CLOSEPORT, WAITPKT)
  29.  
  30. */
  31.  
  32. /* Open rexxsupport.library, and AMFTP Rexx-Port */
  33. OPTIONS RESULTS
  34. ADDLIB("rexxsupport.library",0,-30,0)
  35. RXLIB "AMFTP.1"
  36. ADDRESS 'AMFTP.1'
  37.  
  38. /* Create MessagePort */
  39. CALL OPENPORT("AMFTP-RESULT.1")
  40.  
  41. /* Change local directory */
  42. say "Change local directory..."
  43. CHANGELOCALDIR "RAM:"
  44.  
  45. /* Sending a file 'a'*/
  46. say "Sending ..."
  47. SEND "a"
  48. WAITACTION "AMFTP-RESULT.1"
  49. CALL WAITPKT "AMFTP-RESULT.1"
  50.  
  51. LASTRC
  52. say RESULT
  53.  
  54. /* Sending a file 'b'*/
  55. say "Sending ..."
  56. SEND "b"
  57. WAITACTION "AMFTP-RESULT.1"
  58. CALL WAITPKT "AMFTP-RESULT.1"
  59.  
  60. LASTRC
  61. say RESULT
  62.  
  63. /* Close Connection */
  64. CLOSE
  65.  
  66. /* Close our MessagePort */
  67. CALL CLOSEPORT "AMFTP-RESULT.1"
  68.