OS2 World.Com Forum

Subject  :  FTP. TFTP, and REXX
Author  :  dljone9 dljone9@os2world.com
Date  :  20 Aug, 2004 on 18:35
I work for a fairly large coproration that has more than several hundred OS/2 servers in the field. I want to deploy a REXX script that uses FTP or TFTP to copy a file from a certain subdirectory on every server - to a server in our lab. I am not real astute with REXX, but I do have folks who I can work who may help. I just need to get the basic syntax down, as follows:

d:
cd (directory with files)
rename (filename) (newfilename)
tftp connect (tftp host) userid password
put (filename)
quit

I can set up the server real easy - I just need some coaching on
the REXX syntax for scripting FTP and TFTP transfers.

Much obliged for any help you may offer...

Daniel


Subject  :  Re:FTP. TFTP, and REXX
Author  :  TimC tcardoz@surewest.net
Date  :  21 Aug, 2004 on 02:06

dljone9 (20 Aug, 2004 18:35):
I work for a fairly large coproration that has more than several hundred OS/2 servers in the field. I want to deploy a REXX script that uses FTP or TFTP to copy a file from a certain subdirectory on every server - to a server in our lab. I am not real astute with REXX, but I do have folks who I can work who may help. I just need to get the basic syntax down, as follows:

d:
cd (directory with files)
rename (filename) (newfilename)
tftp connect (tftp host) userid password
put (filename)
quit

I can set up the server real easy - I just need some coaching on
the REXX syntax for scripting FTP and TFTP transfers.

Much obliged for any help you may offer...

Daniel


Try this:


/* REXX */

Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
Call SysLoadFuncs

Call RxFuncAdd 'FtpLoadFuncs','rxFtp','FtpLoadFuncs'
Call FtpLoadFuncs

host_Name = '_______' <=== recipient ftp server
UID = '______' <=== sender's userid on ftp server
PSWD = '_______' <=== sender's password on ftp server

rc = FtpSetUser(host_Name,UID,PSWD)
Say 'FtpSetUser rc ='rc

HostOS = FtpSys(HostOS)
Say 'FtpSys rc ='rc
Say 'HostOS ='HostOS

rc = FtpPut("d:\text.tmp","text.tmpa)","ASCII") <=== for example
Say 'FtpPut (A) rc ='rc
rc = FtpPut("d:\text.tmp","text.tmpb)","ASCII") <=== and again
Say 'FtpPut (B) rc ='rc

rc = FtpLogoff()
Say 'FtpLogoff rc ='rc

Return
/* ----------------------------------------------------------- */


The Say commands are just simple documentation, of course. Also,
if you don't want to show the userid and/or password in this Rexx
exec, look into the use of a NETRC file.

For much more info, see the RXFTP.INF and RXSOCKET.INF help files.

---
Tim H Cardozo
OS/2 SIG of the Sacramento PC Users Group
SIG Leader


Subject  :  Re:FTP. TFTP, and REXX
Author  :  dljone9 dljone9@os2world.com
Date  :  21 Aug, 2004 on 04:45
Thanks a million - will try this on Monday...

You rock!


Powered by UltraBoard 2000 <www.ub2k.com>