The script is in a source member - right? What I've done in the past is, I write a program that updates the source member with the file name that you need for the next FTP session. In fact, you could have your program write/re-write the entire FTP script member. I could find the code if you need it.
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
FTP Script
Collapse
X
-
FTP Script
Here's the code... Basically when you open a source file (In this case QFTPSRC) - the fields are SRCSEQ, SRCDAT, and SRCDTA. SRCSEQ is the key to the record, and SRCDTA is the actual data for each line. So, in this programs case, we knew that the UserID and password were on SRCSEQ "1" of the member, and the PUT command was on SRCSEQ "2". All the RPG program does is open the file, and read and re-write the record. Then the CL calls the FTP command after this RPG runs. Hope that helps.
Code
Comment
-
FTP Script
If I could just add a little to your suggestions, Jeff and Steve, the tweak I put on that is that in the sample script given above, I put an &KEYWORD in place of any variable portion of the script. Then I rebuild from first source file to second script file, line for line, then FTP with script and direct output to a third file to examine for error code. Files are multi-member, with app doing an override on all three files to same member. &KEYWORD is key into an options file to get value that is set by the app doing the FTP. It's not unusual to have two and maybe three &KEYWORD names embedded in the filename, plus maybe others such as directory, depending on requirements from customer. The app code needs to know about the options file fields that need set prior to doing the FTP, but other than that the FTP process is app independent. Changes can be made to each source member such as changing an IP address to a DNS name or changing login or password without any effect on programming. rd
Comment
Comment