Example: Creating a CL program to start FTP
This is an example CL program to start File Transfer Protocol (FTP) in batch mode. The CL program contains commands to override the command input and message output, start the FTP, and delete the overrides when the FTP is closed.
- As shown in the simple example, FTP uses the display
station for command INPUT and message OUTPUT, and this needs to be overridden
for use in batch mode. In this example, the OVRDBF command is used 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)
- 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 you want to specify the remote systems in the input commands file
instead of the CL program file, you must specify a dummy host name 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,
these entries are not required, and the first entry must be an OPEN subcommand
to connect to the required FTP server.
FTP processes the input file and writes messages to the output file (FTPLOG).FTP RMTSYS(LOOPBACK)
- 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.