Here are the general steps to FTP an iSeries file (.CSV or .PDF or whatever) from the IFS to a non-iSeries folder. Note that you can also use an Open Source app such as FileZilla on the PC to do the same thing manually. The iSeries method is preferable (in my mind, at least) because it can be embedded in a CL program.
Type FTP RMTSYS(remote.system.name) on the iSeries command line and press Enter.
You'll be prompted for a user id and password for the remote system; enter those.
At the FTP prompt, type the following:
- bin
- na 1
These FTP commands set up the environment.
Use the FTP 'cd' command to change to the folder on the remote system where the file is to be transferred to.
Use the FTP 'put' command to transfer the IFS file to the remote system. For example:
- put /home/finance/spreadsheet.csv spreadsheet.csv
transfers the spreadsheet.csv file located in the IFS /home/finance directory to a file named spreadsheet.csv in whatever the current remote folder is.
- quit
Terminates the FTP session.
If you want to automate the process using a CL, you can do the following:
- Create a PF-SRC file called QFTPSRC to hold FTP input and output members.
- In QFTPSRC, create a member (we will call it FTPIN) as a TXT type member that contains the following lines; ignore the instructions in parenthesis:
user userid userpassword (again, these are for the remote system)
bin
na 1
cd /transferfolder (or whatever path on the remote system you want to put the file into)
put /home/finance/report.pdf report.pdf (substitute the local IFS path name for your own)
quit
- Create another QFTPSRC member called FTPOUT as a TXT member. Nothing needs to go in it.
In your CL, you can include the following commands to execute the FTP script in FTPIN:
OVRDBF FILE(INPUT) TOFILE(LIB/QFTPSRC) MBR(FTPIN)
OVRDBF FILE(OUTPUT) TOFILE(LIB/QFTPSRC) MBR(FTPOUT)
FTP RMTSYS(REMOTE.SERVER.NAME)
MONMSG MSGID(FTP0000) EXEC(DO)...
The output from the FTP session will be written to the FTPOUT member. This is useful for troubleshooting.
Hopefully this will give you enough to get started. Let me know if you have any other questions or need clarification on anything.