Using FTP in Batch Mode
FTP (File Transfer Protocol) can be used to transfer data from an MVS host
to another MVS host. Although it is commonly used interactively, FTP can
be used to tranfer files in batch mode which allows unattended file transfer.
Here is an example of some JCL to do this.
//S2 EXEC PGM=FTP,REGION=2000K,DYNAMNBR=20,
// PARM='188.8.131.52 (EXIT'
//SYSPRINT DD SYSOUT=*
//OUTPUT DD SYSOUT=*
//NETRC DD DISP=SHR,DSN=&SYSUID..NETRC
//INPUT DD *
GET prof(isrprof) temp (REPLACE
The EXIT option causes FTP to terminate on an error. It also causes the
return code to be set if an error occurs. In the example above, 184.108.40.206 is
the IP address of the remote host. There must be an FTP server running on that
An existing dataset named userid.NETRC, where userid submitted
this job, will be used to retrieve userid and password information. Entries
in this dataset look like:
000001 MACHINE 220.127.116.11 LOGIN user PASSWORD pswd
where user is the userid for host 18.104.22.168 and pswd is the
password. This eliminates the need to put the userid and password in the JCL.
The GET command moves data from the file prof on the foreign host
(22.214.171.124) to the file temp on the local host (the host where the
batch job is running). A PUT command would move data the other way.
Note that the example above is based on Version 3.1 of the IBM TCP/IP
product. Refer to the documentation for your TCP/IP product for more
An earlier topic discussed submitting jobs using
FTP from non-MVS systems.
Comments or suggestions can be
sent to the author.
Last Month's Topic