At my clients place, we FTP an e-mail file to a third-party vendor daily; this happens as a batch process. The vendor wants the file to be suffixed with the current date, so they can standardize the input. But, batch FTP needs the script in a PF member. To change the file name in the FTP input script (PF/Member), we used a FREEWARE-SQLSTM to update the statement in the script with the current date.
This below method can be used for changing the script dynamically -- if you are already using the batch FTP process.
CUSTLIB/INPUT - FTP INPUT file (File with SCRIPT)
CUSTLIB/EMAILPF -- E-mail file, that needs to be sent via FTP to the Client
Flmmddyy.txt - Filename on the Client side
SQLSTM - SQL command that runs in the CL. (There are several utilities which
offer a way to execute SQL via a standard command interface)
Code
0146.00 /* SET THE OUT FILE ON CLIENT SIDE AS "FLmmddyy.txt" */
0147.00 RTVJOBA DATE(&DATE)
0148.00 CHGVAR &VAR1 (&DATE *CAT '.TXT')
0149.00 CHGVAR VAR(&STMT) VALUE('UPDATE CUSTLIB/INPUT +
0150.00 SET FTPINPUT = ''PUT CUSTLIB/EMAILPF +
0151.00 FL' *CAT &VAR1 *TCAT ''' +
0152.00 WHERE SUBSTR(FTPINPUT,1,3) = ''PUT'' ')
0153.00
0154.00 SQLSTM CMD(&STMT)
0155.00
FTP INPUT File (Script for FTP)
Display Physical File Member CUSTLIB/INPUT
FTPINPUT is the only field with 80 chars.
File . . . . . . : INPUT Library . . . . : SONOMA
Member . . . . . : INPUT Record . . . . . : 1
Control . . . . . Column . . . . . : 1
Find . . . . . . .
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7.
userid password
SENDPASV 0
PUT INPUT/CUSTLIB Flmmddyy.TXT
QUIT
****** END OF DATA ******
Note: Search the Search400.com tips section on how to FTP from iSeries. Interactively, batch, etc.
==================================
MORE INFORMATION ON THIS TOPIC
==================================
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.