Example: Create the FTP input file (FTCPDMS)

The FTP input file must contain all the FTP client subcommands necessary to connect and log on to the server, set up and complete the file transfers, close the server connection, and end the client session. The following example shows the subcommands used for transferring files to two different remote systems.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
Figure 1. Transferring files to two remote systems
   ___________________________________________________________________________________ 
   |                                                                                  | 
   |  Columns . . . :    1  71           Browse                     GERRYLIB/QCLSRC   | 
   |  SEU==>                                                                FTPCMDS   | 
   |  FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5...+... 6 ...+... 7    | 
   |         *************** Beginning of data*************************************   | 
   | 0001.00 gwil ****                                                                | 
   | 0002.00 close                                                                    | 
   | 0003.00 open sysnamrs                                                            | 
   | 0004.00 user root root                                                           | 
   | 0005.00 ascii                                                                    | 
   | 0006.00 syscmd dltf file(gerrylib/rs6)                                           | 
   | 0007.00 get /Itsotest gerrylib/rs6.rs6                                           | 
   | 0008.00 close                                                                    | 
   | 0009.00 open mvax                                                                | 
   | 0010.00 user tester tester                                                       | 
   | 0011.00 get screen1.file gerrylib/vax.vax (replace                               | 
   | 0012.00 close                                                                    | 
   | 0013.00 open sysnam02                                                            | 
   | 0014.00 user gwil ****                                                           | 
   | 0015.00 ebcdic                                                                   | 
   | 0016.00 put gerrylib/rs6.rs6 gerrylib/rs6.rs6                                    | 
   | 0017.00 quote rcmd sndnetf file(gerrylib/rs6) tousrid((gwilsysnam14))            | 
   | 0018.00 close                                                                    | 
   | 0019.00 quit                                                                     | 
   |         ****************** End of data****************************************   | 
   |  F3=Exit   F5=Refresh   F9=Retrieve   F10=Cursor   F12=Cancel                    | 
   |  F16=Repeat find        F24=More keys                                            | 
   |                                                                                  | 
   |__________________________________________________________________________________|

The following explanation might help you to understand the FTP client subcommands shown in Figure 1. The line numbers on the display correspond to the numbers that follow.

0001
User ID and password for dummy connection within client iSeries™ SYSNAM03.
0002
Close dummy connection in iSeries SYSNAM03.
0003
Open control connection to RISC System/6000® SYSNAMRS.
0004
USER subcommand with user ID and password for SYSNAMRS.
Note: When running FTP in batch mode, the USER subcommand must follow an OPEN subcommand. Both the logon user ID and password parameters for the USER subcommand should be provided. This is different when operating FTP interactively online. When FTP is run interactively online, and then the client will automatically initiate a USER subcommand and prompt you for a logon ID. There is no automatic USER subcommand when running FTP in batch mode.
0005
Transfer ASCII data (will be converted on iSeries to/from EBCDIC).
0006
CL command to be run on client iSeries: delete file. Instead parameter (REPLACE can be used with the next statement.)
0007
Retrieve file from RISC System/6000 system.
0008
Close control connection to RISC System/6000 SYSNAMRS.
0009
Open connection to VAX MVAX.
0010
USER subcommand with user ID and password for MVAX.
0011
Retrieve file from VAX replacing existing iSeries file.
0012
Close control connection to VAX MVAX.
0013
Open control connection to remote iSeries SYSNAM02.
0014
USER subcommand with user ID and password for SYSNAM02.
0015
Transfer EBCDIC data (as it is from iSeries to iSeries).
0016
Send iSeries file to iSeries SYSNAM02 with TCP/IP.
0017
Send this file from server iSeries SYSNAM03 to remote iSeries SYSNAM14 through TCP/IP network.
0018
Close control connection to iSeries SYSNAM02.
0019
End FTP application.