Example: Create a CL program to start FTP

  1. As shown in the previous example, FTP uses the display station for command INPUT and message OUTPUT, and this needs to be overridden for use in batch mode. We use the OVRDBF command to overwrite these files with the ones to be used in batch:
               OVRDBF FILE(INPUT) TOFILE(GERRYLIB/QCLSRC) MBR(FTPCMDS) 
               OVRDBF FILE(OUTPUT) TOFILE(GERRYLIB/QCLSRC) MBR(FTPLOG) 
  2. A host name or an internet address is a required parameter for the STRTCPFTP command that is included in the CL program file. However, if one wants to specify the remote systems in the input commands file instead of the CL program file, then a dummy host name must be specified for the STRTCPFTP command to satisfy the required syntax. This dummy name can be a fictitious host name or a real host name. If it is a real name, then the first entry in the input commands file must be a user ID and a password, and the second entry must be the CLOSE subcommand. If it is not a real host name, then these entries are not required, and the first entry should be an OPEN subcommand to connect to the required server system.
                 FTP RMTSYS(LOOPBACK) 
    FTP processes the input file and writes messages to the output file (FTPLOG).
  3. After the FTP application ends, delete the overrides:
                 DLTOVR     FILE(INPUT OUTPUT) 

    The CL program for batch FTP will look like the following example, in Figure 1, on system SYSNAM01:

    Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
    Figure 1. CL program FTPBATCH for batch FTP
        ___________________________________________________________________________________
       |                                                                                   | 
       |  Columns . . . :    1  71           Browse                      GERRYLIB/QCLSRC   | 
       |  SEU==>                                                                FTPBATCH   | 
       |  FMT **  ...+... 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7    | 
       |         *************** Beginning of data *************************************   | 
       | 0001.00 PGM                                                                       | 
       | 0002.00              OVRDBF     FILE(INPUT) TOFILE(GERRYLIB/QCLSRC) +             | 
       | 0003.00                           MBR(FTPCMDS)                                    | 
       | 0004.00              OVRDBF     FILE(OUTPUT) TOFILE(GERRYLIB/QCLSRC) +            | 
       | 0005.00                           MBR(FTPLOG)                                     | 
       | 0006.00              FTP        RMTSYS(LOOPBACK) /* (FTP CL Program) */           | 
       | 0007.00              DLTOVR     FILE(INPUT OUTPUT)                                | 
       | 0008.00 ENDPGM                                                                    | 
       |         ****************** End of data ****************************************   | 
       |                                                                                   | 
       |                                                                                   | 
       |  F3=Exit   F5=Refresh   F9=Retrieve   F10=Cursor   F12=Cance                      | 
       |  F16=Repeat find        F24=More keys                                             | 
       |                                          (C) COPYRIGHT IBM CORP. 1981, 1994.      | 
       |                                                                                   | 
       |___________________________________________________________________________________|