I'll tell you the way I do it. There are other ways, but I've found this method to be quite effective.
I store the FTP user ID and the FTP password in a secured data area. A user space would be another good choice.
I build the FTP session commands (or FTP Script) on the fly using an RPG or COBOL program, and store the session commands in a file in QTEMP.
I put a CL program wrapper around the whole thing, and it works nicely. The CL program must be secured, and adopt enough authority to read the Data Area.
The script for a simple file transfer is rather straightforward. Here's what typically on each line, and what your COBOL or RPG Program needs to build.
PUT MYLIB/MYFILE YOURFILE
Here's the main slice of the CL code I use.
CRTSRCPF FILE(QTEMP/INPUT) MBR(INPUT) MONMSG CPF0000 Exec(Do) CLRPFM FILE(QTEMP/INPUT) MBR(INPUT) EndDo CRTSRCPF FILE(QTEMP/OUTPUT) MBR(OUTPUT) MONMSG CPF0000 Exec(Do) CLRPFM FILE(QTEMP/OUTPUT) MBR(OUTPUT) EndDo OVRDBF FILE(INPUT) TOFILE(QTEMP/INPUT) + MBR(INPUT) RTVDTAARA DTAARA(FTPUSER (1 10)) RTNVAR(&FTPUSER) RTVDTAARA DTAARA(FTPUSER (11 10)) RTNVAR(&FTPPASS) /* Build FTP Script parameters are USERID and PASSWORD */ CALL BUILDFTP PARM(&FTPUSER &FTPPASS) /* Add records to file QTEMP/INPUT */ OVRDBF FILE(OUTPUT) TOFILE(QTEMP/OUTPUT) + MBR(OUTPUT) /* Do The FTP SESSION */ FTP RMTSYS(MYSYSTEM) /* Print the actual FTP session data for diagnostic purposes */ CPYF FROMFILE(QTEMP/OUTPUT) TOFILE(*PRINT)
MORE INFORMATION ON THIS TOPIC
The Best Web Links: Tips, tutorials and more.
Search400.com's targeted search engine: Get relevant information on security.
Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.
Read this Search400.com Featured Topic: Secure your iSeries
Dig Deeper on iSeries system and application security
Related Q&A from Carol Woodbury
Before changing password levels and upgrading operating systems on the AS/400, ensure the clients connecting to the NetServer do not need the old ... Continue Reading
Look in the audit journal (QAUDJRN) on the AS/400 for an authority failure message with the name of the library as the object name. Use the ... Continue Reading
The UPPWEI field corresponds to the password expiration interval field, and its values "0" and "-1" represent the *SYSVAL and *NOXMAX commands. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.