Make your own free website on Tripod.com
DocBag

Back Issue

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='142.10.5.8 (EXIT' //SYSPRINT DD SYSOUT=* //OUTPUT DD SYSOUT=* //NETRC DD DISP=SHR,DSN=&SYSUID..NETRC //INPUT DD * CD ispf DIR LCD prof GET prof(isrprof) temp (REPLACE DIR QUIT // 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, 142.10.5.8 is the IP address of the remote host. There must be an FTP server running on that host.

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 142.10.5.8 LOGIN user PASSWORD pswd where user is the userid for host 142.10.5.8 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 (142.10.5.8) 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 information.

An earlier topic discussed submitting jobs using FTP from non-MVS systems.

Feedback

Comments or suggestions can be sent to the author.

Last Month's Topic

Big Iron