Override the file name during batch FTP

55 pts.
Tags:
Application development
AS/400
DataCenter
Development
We use ftp to send iseries files to our server. We use a script in a member in QTXTSRC. This script contains the library/file name to PUT. We would like change the file name in the CL to contain a date stamp and then use this file name to sent to the server. How can i override the file name on the put entry in the QTXTSRC script file.
ASKED: August 18, 2006  1:04 PM
UPDATED: December 15, 2009  7:54 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

if you’ll put the file into a separate library then use CHGCURLIB before executing your ftp script. Another option is to do a LCD YOURLIB (local change directory) within your script.

good luck.

===================================================

Create a ‘template’ script with a line like PUT @@@@@@@@@@
Copy the template into your QTEMP file before running FTP.
Create a QM query that UPDATEs the script replacing either the entire PUT line or just the special characters with whatever is needed.
Then run FTP.

Tom

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • BikerDude
    if you'll put the file into a separate library then use CHGCURLIB before executing your ftp script. Another option is to do a LCD YOURLIB (local change directory) within your script. good luck.
    0 pointsBadges:
    report
  • astradyne
    Hi Not sure if I'm missing something, but is there any reason why you can't edit the source member and simply change it? The fact that you're using an FTP script indicates that you have the source member. If you're looking for a way to change the name of the file each time by adding a timestamp to the file name then you need to generate the script source member using something like RPG. The way I would do it would be to have the script member in QTXTSRC, then in CL override to use the particular source member and in RPG open the source file under user control. I would then use RRN to chain to the PUT statement and have the RPG program replace the source line (field SRCDTA) with the new timestamped line. Close the file and then run the FTP script. Job done. Hope it helps, if you need any help in coding the logic just let me know. All the best Jonathan
    370 pointsBadges:
    report
  • Jgsnsbt
    We are doing the same all the time; just the other way 'round: create the file to send in QTEMP (if You already have it, omit this step; just make sure only one job at a time is playing with the file), send it (always with the same script), CPYF-it to a extra lib with timestamp in the filename. That's it!
    30 pointsBadges:
    report
  • Oldgrayprogrammer
    We do this all the time ... I change the script file during the execution and actually update the put command with a small RPG program. Just read through your script looking for the put statement ... change it according to your needs, then execute it. Here is an example ... H/TITLE ENFTPU04 - UPDATE FTP SCRIPT FILE (CLDS) H F* FFTPSRC UF E DISK F FTPSRC KRENAMEFTPSRCR E CMD1 1 7 60 COMMAND ARRAY E/EJECT C MOVE *ZEROS COUNT 50 C* C MOVE *BLANKS TIMSTP 12 C TIME TIME12 120 C MOVELTIME12 HHMMSS 6 C MOVE TIME12 MMDDYY 6 C MOVELMMDDYY MMDD 4 C MOVE MMDDYY YY 2 C YY CAT MMDD:0 TIMSTP C TIMSTP CAT HHMMSS:0 TIMSTP C* C READ FTPSRC LR C* C *INLR DOWEQ*OFF C* C MOVELSRCDTA STR3 3 C* C* MODIFY THE FIRST "PUT" COMMAND, THEN BALE C STR3 IFEQ 'put' C STR3 OREQ 'PUT' C MOVELCMD1,1 SRCDTA P C SRCDTA CAT TIMSTP:0 SRCDTA C SRCDTA CAT CMD1,3:0 SRCDTA C UPDATFTPSRCR C ADD 1 COUNT C MOVE *ON *INLR C RETRN C END C READ FTPSRC LR C END C* C RETRN C/EJECT D1 M4R3LIB/CLDS@.TODAY CLDS @@@@@@@@@
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following