Monday, September 26, 2011

JCL: Sample FTP jobs

Copying file from a server to mainframe


The below FTP job does the following actions.


1.Logs on to MY.FTP.SERVER.COM 
2.Goes to folder  "DEVELOPMENT/FRM/DATA04" and copies "TEST.TXT" 
3.Allocates sequetial file 'MF.DATA.SET' with RECFM=FB LRECL=167
4.Writes the contents of "TEST.TXT" to the newly allocated sequential file.  


//STEP1 EXEC PGM=FTP
//SYSIN DD *
MY.FTP.SERVER.COM
USERID
PASSWORD
CD /DEVELOPMENT/FRM/DATA04
LOCSITE RECFM=FB LRECL=167
GET TEST.TXT 'MF.DATA.SET'
QUIT
//*


“locsite” command is used to supply the LRECL and RECFM for the new dataset. The other DCB parameters will be taken from SYS1.TCPPARMS(FTPDATA).


Copying file from mainframe to a server


The below job writes a mainframe dataset to a server. The "ASCII" statement instructs FTP program to convert EBCDIC to ASCII before  storing the file in the server.


//STEP1 EXEC PGM=FTP
//SYSIN DD *
MY.FTP.SERVER.COM
USERID
PASSWORD
ASCII
CD /DEVELOPMENT/FRM/DATA04
LOCSITE RECFM=FB LRECL=167
PUT 'MF.DATA.SETTEST.TXT
QUIT
//*

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.