FTP



This document describes a few useful hints about FTP Step, which can be used for sending some file from mainframe region to some Unix server directly, using IP addresses.

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.

The calling main program step is here:

//G2SS90PI JOB (ATBC-GNLDGRP,PROD),'NDM GEIS DRAFTS',
//         CLASS=B,MSGCLASS=J,NOTIFY=G2IOPCT
//JOBLIB   DD DSN=G2C000F.PROD.LOADLIB,DISP=SHR
//* Following is the FTP Step
//FTPSTEP1 EXEC PGM=FTP
//SYSPRINT DD SYSOUT=*
//OUTPUT   DD SYSOUT=*
//INPUT    DD DSN=G2SS00AP.FINSYS.PARMLIB(G2SS90PI),DISP=SHR
/*

Here the INPUT stands for the file where FTP instructions are coded. The INPUT file is here:

205.173.93.34
19730501@209.84.109.3
gkxx~l3"
cd \1973\05\01\pd\disbursement
put 'G2SS00AP.SS90.GEIS.DRAFTS(0)' g2ss00ap.gechk.txt
LOCSITE LR=lllll BLK=bbbbb REC=FB TR PRI=primary SEC=secondary U=ACADA
get inputfile.dat 'G1SG00AT.TEST.FLATFILE' (replace
close
quit

Here

205.173.93.34 - is the IP address of remote FTP server
19730501@209.84.109.3 - is username on remote server
gkxx~l3" - password on remote server
cd command specifies the directory where file is to be copied to/from
put ‘mainframe_source_file_name’ target_file_name

Here source file name is the data set name that is there in mainframe. 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. The target file is the name of file that will get created from this source file, onto the target computer directly. Get command does the reverse, i.e. copies the file from UNIX to Mainframe data set.

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 are spaces in tracks.

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




Important note:

The source file might be created within the same job in which FTP step is executed or some other job also can create this source file. In case it is a GDG, then precaution has to be taken while coding the GDG version.

Even if the GDG is getting created within the same job in which FTP step is executed, then also to refer to the current version of GDG (say the GDG version which is to be sent by FTP) within FTP step (here within INPUT file), version(0) is to be used and not version(+1).

Similarly if GDG is created within FTP step (+1), then also to refer to that GDG in later steps in the same JCL, we will be referring to the (0) version of the GDG.

This is because the FTP step can be treated as a different job although it is syntactically within the same job.



Comments

Popular posts from this blog

Date/time constants in JCL

JCL ABeND --

IEBGENER usage examples