home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ANews 1
/
AnewsCD01.iso
/
Internet
/
FTP
/
AmFTP
/
Rexx
/
receive.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-08-11
|
2KB
|
79 lines
/*
AmFTP Rexx-Port Example Script, receive.rexx
Copyright © 1995-1996 by Mathias Mischler, All Rights Reserved.
This easy example script connects to a host (ftp.vapor.com) and
simply gets a file (AmFTP153.lzx) from a directory (support/amftp).
Afterwards connection is closed and AmFTP quits.
This script was written to show the use of the AmFTP Rexx Port,
because the is a major AmFTP-Rexx problem: AmFTP is a asyncronious
program, so we _can't_ just start a command and than next one.
Solution: What we have to do, is to _initiate_ a command, wait until
command is ready and than initiate next one (wait for this...).
AmFTP provides following functions to easy handle this:
INACTION:
INACTION returns 0 when AmFTP is free to get new commands.
returns 1 when AmFTP is busy on working.
WAITACTION PORT:
WAITACTION tells AmFTP to send a message to a specified MessagePort
when it is ready with last command. So you can just do a WAITPKT.
This example shows how to wait on such messages. We need to open
rexxsupport.library to use
OPENPORT to create a MessagePort,
CLOSEPORT to close a MessagePort and
WAITPKT to wait for a message from AmFTP.
(See also rexx.guide OPENPORT, CLOSEPORT, WAITPKT)
*/
/* Open rexxsupport.library, and AMFTP Rexx-Port */
OPTIONS RESULTS
ADDLIB("rexxsupport.library",0,-30,0)
RXLIB "AMFTP.1"
ADDRESS 'AMFTP.1'
/* Create MessagePort */
CALL OPENPORT("AMFTP-RESULT.1")
/* Change local directory */
say "Change local directory..."
CHANGELOCALDIR "ram:"
ISCONNECTED
say result
/* Connect to host */
say "Connect..."
CONNECTHOST "ftp.vapor.com"
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
/* Change remote directory */
say "Change remote directory..."
CHANGEDIR "support/AmFTP"
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
/* Receive a file */
say "Receive AmFTP153.lha..."
RECEIVE "AmFTP153.lha"
WAITACTION "AMFTP-RESULT.1"
CALL WAITPKT "AMFTP-RESULT.1"
/* Close Connection */
CLOSE
/* Quit AmFTP */
QUIT
/* Close our MessagePort */
CALL CLOSEPORT "AMFTP-RESULT.1"