FTPing Using Batch Jobs



Introduction
From a Remote Server to MVS DASD Disk System
To a Remote Server from MVS DASD Disk System


Introduction


The following describes how to ftp files to and from the MVS DASD disk system using batch jobs.

This documentation was produced by the Academic Research and Data Center of USC.  Questions about its content should be referred to a consultant, 777-6865.

TSO/ISPF Users Please Note:
Turning on Line Numbers in columns 73-80 can cause problems. For example, in the line with the server host address, the line number in columns 73-80 is read by the FTP client program as the port number to be used in connecting to the ftp server.   The port number should be allowed to default to port 21, unless otherwise specified by the server sysadmin.

These job setups assume ascii file transfer.   To transfer binary files, use the BINARY command prior to the PUT or GET command.

FTPing a File From a Remote Server to MVS DASD Disk System


//* Generic Job Setup - JOB Statement here
//* BATCH JOB TO FTP FILE FROM REMOTE SERVER TO MVS DISK SYSTEM
// EXEC FTP
//INPUT DD *
IP address of remote ftp server (target or server host)
username on remote server
password on remote server
CD command goes here if needed
LOCSITE LR=lllll BLK=bbbbb REC=FB TR PRI=primary SEC=secondary U=ACADA
GET remote.filename 'USERID.DASD.DSN'
QUIT
//

Do not specify a region on the EXEC statement. The batch proc requests 4M for the step - JCL that specifies less than 4M may fail.

Be sure to observe case in remote server usernames, passwords and file descriptors.

CD command is used to change directories on the remote server if your default login does not go to the directory containing the file you want to ftp to the MVS ftp server.

For ASCII file transfers (raw data, program source, etc) the following parameters should be used in the LOCSITE command

lllll is record length of the remote file. For variable length records, it is the length of the longest record + 4 bytes for the record-length descriptor word.

bbbbb is the block-size of the MVS data set. For fixed length records, use the largest exact multiple of 'lllll' that does not exceed 28000. For variable-length records, (RECFM=VB or VBS, etc), use ????????????.

primary and secondary space in tracks. To determine these you can use the DISKSTOR command on CMS (or the BLKSIZE command on TSO). A sample DISKSTOR session below calculates primary and secondary space allocations for a file with 50,000 400-byte records.


DISKSTOR   (press enter)

This EXEC suggests SPACE parameters for a data set that will contain blocked records (RECFM=FB or VB) and will reside on a 3390 storage device.
For variable length records, include the 4 bytes for the record descriptor word in the record length, and precede it with a "V" (e.g., V137).

Enter the record length (LRECL):
 400  (press enter)

Enter the estimated number of records in the data set:
 50000 (press enter)
Suggested JCL parameters:
     DSN=your choice,DISP=(NEW,CATLG,DELETE),
     DCB=(RECFM=FB,LRECL=400),
     UNIT=DASD,  for permanent data sets
     UNIT=SYSDA, for temporary data sets (deleted at end of job)
     SPACE=(TRK,(363,37),RLSE)

NOTE:  You should not specify BLKSIZE in your job setup;
the system will select an optimal value for it.

end-of-DISKSTOR-session

For FTPing files to MVS, you can store data more efficiently by ignoring the NOTE about omitting BLKSIZE, and specifying a BLKSIZE that is the largest multiple of the LRECL <= 28000.

Thus, the LOCSITE command would be:


LOCSITE LR=400 BLK=28000 REC=FB TR PRI=363 SEC=37


In the generic job above, suppose the following were true:

  remote server name is:   iris.garden.sc.edu
  username is:             janed
  password Is:             TluktF
  directory with file:     /tempspace/jdoe/
  filename:                mydata.raw
  CMS userid is:           JANEDOE
  batch account number is: I7700000
  new MVS DSN will be:     JANEDOE.MYDATA.NEW

Then the batch job would be:

//FTPMVS JOB (I7700000,25),DOE,MSGLEVEL=(1,1),TIME=2,
//   USER=JANEDOE,PASSWORD=????????
/*ROUTE PRINT VM.JANEDOE
//* BATCH JOB TO FTP FILE FROM REMOTE SERVER TO MVS DISK SYSTEM
// EXEC FTP
//INPUT DD *
iris.garden.sc.edu
janed
TluktF
CD /tempspace/jdoe
LOCSITE LR=400 BLK=22800 REC=FB TR PRI=363 SEC=37
GET mydata.raw 'JANEDOE.MYDATA.NEW'
QUIT
//

FTPing a File to a Remote Server From MVS DASD Disk System

You should first make certain that all MVS data sets to be ftp'ed to another server are not on the migration disks or tapes.   DSUTIL's DSSLIST command will show the status of any data set:  DASD (on active disk volumes), MIGR1 (on migration disk volumes) or MIGR2 (on migration cartridge tapes.)   Data sets with status of MIGR1 or MIGR2 should be recalled before attempting to ftp them.

Batch job for DSSLIST:


//* Generic Job Setup - JOB Statement here
// EXEC DSUTIL
//SYSIN DD *
 DSSLIST DSN=JANEDOE
//


Batch job to recall migrated data sets:

//* Generic Job Setup - JOB Statement here
//*  JOB SETUP TO QUEUE UP RECALL REQUESTS ON TSO.
//*  NOTE THAT USERID IS OMITTED IN DSNS ON THE RECALL STATEMENTS
//*  ACTUAL DSNS BEGIN WITH JANEDOE.....
// EXEC PGM=IKJEFT01,DYNAMNBR=10,REGION=2M
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
PROFILE PREFIX(JANEDOE)
HRECALL PRETEST.FILE1
HRECALL PRETEST.FILE2
HRECALL PRETEST.FILE3
HRECALL POSTTEST.FILE1
HRECALL POSTTEST.FILE2
HRECALL POSTTEST.FILE3
//

Batch job to FTP file to remote server from MVS disk system:

//* Generic Job Setup - JOB Statement here
//* BATCH JOB TO FTP FILE TO REMOTE SERVER FROM MVS DISK SYSTEM
// EXEC FTP
//INPUT DD *
IP address of remote ftp server (target or server host)
username on remote server
password on remote server
CD command goes here if needed
binary command goes here if needed
PUT 'USERID.DASD.DSN' remote.filename
QUIT
//

In the generic job above, suppose the following were true:

  remote server name is:   iris.garden.sc.edu
  username is:             janed
  password Is:             TluktF
  directory with file:     /tempspace/jdoe/
  new remote filename:     mydata.raw
  CMS userid is:           JANEDOE
  Batch account number is: I7700000
  Existing MVS DASD file:  JANEDOE.MYDATA.NEW
Then the batch job would be:

//FTPMVS JOB (I7700000,25),DOE,MSGLEVEL=(1,1),TIME=2,
//   USER=JANEDOE,PASSWORD=????????
/*ROUTE PRINT VM.JANEDOE
//* BATCH JOB TO FTP FILE TO REMOTE SERVER FROM MVS DISK SYSTEM
// EXEC FTP
//INPUT DD *
iris.garden.sc.edu
janed
TluktF
CD /tempspace/jdoe
PUT 'JANEDOE.MYDATA.NEW' mydata.raw
QUIT
//

ARDC Documentation     ARDC Home Page     USC Home Page    

This page updated July 30, 1999 by Amy W. Yarbrough, Academic Research and Data Center.
Copyright © 1999, The Board of Trustees of the University of South Carolina.
URL http://www.sc.edu/ardc/docs/ftpbatch.htm