Here are the steps to FTP multiple files in batch mode
1) Create an empty member in a source physical file say FTP_RES to receive response log after FTP is complete.Member Type Text
FTP_RES TXT FTP Response File
2) Create another member in a source physical file say FTP_REQ to input FTP instructions. Here is a sample file
Member Type Text
FTP_REQ TXT FTP Request File
{user_id} {password}
bin
na 1
put /{ifs_dir}/{ifs_sub_dir}/{filename1.ext} /{remote_dir}/{filename2.ext }
........
........
get /{remote_dir}/{filename1.ext } /{ifs_dir}/{ifs_sub_dir}/{filename2.ext} (replace
........
........
na 0
put {library}/{filename1} {remote_library}/{filename2}
........
........
get {remote_library}/{filename1} {library}/{filename2} (replace
........
........
quit
The dots mean put more file like the syntax above. Anything within the curly braces{} needs to be replaced with actual values. filename1 and filename2 can be same name. na means naming format. na 1 is used for IFS like directory structure and na 0 used for regular iSeries objects. bin means binary data change it to ascii if your are sending text data.
3) Create the CL program to do the FTP. Here is a sample file
PGM
OVRDBF FILE(INPUT) TOFILE(*LIBL/{source_file}) MBR(FTP_REQ)
OVRDBF FILE(OUTPUT) TOFILE(*LIBL/{source_file}) MBR(FTP_RES)
FTP RMTSYS({host_name or IP Address})
ENDPGM
4) The END!
M new to this ftp cl programming,so can u explain me what this input and output database file should contain...
ReplyDelete.
INPUT and OUTPUT are fictitious files that are overridden to a source physical file with the members as shown above. The FTP_RES is empty and FTP_REQ is what is shown above with all FTP statements.
ReplyDeleteWill be please explain how to start this batch programming for FTP with detailed explaination of each and every step?It would be really helpful to me....
ReplyDeletePlease provide with the complete steps as soon as possible...
ReplyDeleteThose are the detailed steps. It's not that complicated. You just call the CLP program and the INPUT file has the instructions for the FTP.
ReplyDeleteIt seems like you need to familiarize yourself with AS400 CL programming and FTP commands which is not in the scope of this blog article.
Here is a sample how a INPUT file will look like ...
ReplyDeleteuserid password
na 1
lcd /tmp
cd /remotedir
put filename.txt
quit
Please userid, password, directories and filenames with real values
Batch process completed successfully......thanks a lot for ur help....
ReplyDelete