Execute FTP commands in batch on the iSeries
Follow these steps from Search400 member Tim Brinker to execute batch jobs.
On the AS/400 create a flat physical file. This file will contain the User ID and Password to sign for the system, the FTP command will be executed. This file will also contain the FTP commands (PUT, GET..).
Example Flat File Containing the FTP Commands
USERID PASSWORD binary put Library/File Library/File quit
Replace the USERID and PASSWORD in the example file with a valid User ID and Password for the system the FTP will be executing to.
Now to execute the FTP file defined above in a batch job, you need to override the file created above to a file name of INPUT. Then all you need to do is execute FTP with the System Name or IP Address.
Example CL Commands to Execute the FTP
OVRDBF FILE(INPUT) TOFILE(FILECREATEDABOVE) FTP RMTSYS('100.100.1.1') DLTOVR FILE(*ALL)
You can also automate FTP commands from the PC. To do this you need again to create a script (text) file on the PC that contains the FTP commands you wish to execute.
Example PC Text File of FTP commands
open 100.100.1.1 {IP Address of the system you wish to connect to} USERID {User ID for the System You Will Connect to} PASSWORD {Password of the System you Will Connet to) binary get /qsys.lib/temp.lib/temp.file/qtemp.mbr e:qtemp close quit
Now to execute the FTP command to transfer files from the another system to your PC do the following.
Start the MS DOS Prompt and at the DOS prompt enter the following
ftp -s:FILENAME
replace FILENAME with the name that you saved the text file as.
Note: My FTP scripts have "binary" in them. You use binary when you wish to transfer AS/400 Save files between systems.