Page 1 of 1

ftp Job

PostPosted: Thu Jan 14, 2010 2:47 pm
by fuuss
Hello

I have a small problem related with a few questions.

1) What I need to do
I need an Job that is executed in the USS of our Mainframe by a JCL from TWS ( no problem that works)
This job should be an FTP job taking the path and filesnames from a list ( I have created before by a JCL Job)
After Successfully sending the files to the FTp adress the files are getting renamed .
It's important that the files is only renamed if the tranfer worked.

2) Help I need
Is it possible to use Rexx for using FTp in the USS
If yes how should I manage it.
The job should start the connection and then sending the files in an if loop ,if this is done then directly renaming the file on the server and on the local

The list that should be imported is in this format

/T/webapp/logs/test/app1/Timestamp.deported.wasi-1.20091231.093923.log
/T/webapp/logs/test/app2/Timestamp.deported.wasi-1.20091231.093923.log
/T/webapp/logs/test/app2/Timestamp.wasi-2.20091229.225503.log

Even a better idea to resolve this problem would be good
any help is great
Thank you in advance

Christian

Re: ftp Job

PostPosted: Mon Jan 18, 2010 2:21 pm
by fuuss
or maybe somebody could say me how to use Ftp in a Rexx script , I searched the whole weekend but cannot find anything

Re: ftp Job

PostPosted: Mon Jan 18, 2010 11:03 pm
by Robert Sample
Google is your friend. Googling rexx ftp returned 571,000 hits of which several on the first page talk about using the FTP API in REXX that became available with z/OS 1.8 (and they're from IBM, even).

Re: ftp Job

PostPosted: Tue Jan 19, 2010 3:51 pm
by fuuss
Ok FTPAPI was the great words I needed

I found somehint g, I post it here I may help somebody out there

/* rexx */
hostname = 'ftp.server.hostname'
username = 'userid'
password = 'passwd'
ftpapi_rc = FtpApi("fcai.", "create", "")
ftpapi_rc = FtpApi("fcai.", "init", "-w 300" hostname "21")
ftpapi_rc = FtpApi("fcai.", "scmd", "user" username, "W")
ftpapi_rc = FtpApi("fcai.", "scmd", "pass" password, "W")
ftpapi_rc = FtpApi("fcai.", "scmd", "cd directory", "W")
ftpapi_rc = FtpApi("fcai.", "scmd", "get file", "W")
ftpapi_rc = FtpApi("fcai.", "scmd", "QUIT", "W")
ftpapi_rc = FtpApi("fcai.", "term")
address syscall "sigaction" SIGCHLD SIG_DFL 0 "prevhndlr prevflag"

Re: ftp Job

PostPosted: Wed Jan 20, 2010 12:12 am
by dick scherrer
Thank you for posting your code - it probably will help someone later :)

d