Monday 11 March 2013

FTP(Part 10) - FTP in Batch.



Following is a simple FTP job(ftp in batch).

XX00       M0001.EDW.TEST.JCL(TESTSUKU) - 02.07           Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 //TESTSUKU JOB (EWDS),'FTP TEST'                                       
000002 //TESTFTP1 EXEC PGM=FTP,REGION=6144K,                                  
000003 //         PARM='199.145.85.37 (EXIT TIMEOUT 720'                      
000004 //SYSPRINT DD SYSOUT=*                                                 
.JCPA  //OUTPUT   DD SYSOUT=*                                                 
000006 //INPUT    DD *                                                         
000007  M0001 <username>                                                                
000008  jan9th       <password>                                                           
000009  put 'CMN.TEST.BASO.SRC(TEST111A)' 'M0001.test3.src(by14111a)'        
000010  quit                                                                  
****** **************************** Bottom of Data ****************************

REGION=2048K is a minimum requirement. The requirement could increase depending on the block size of the data set being transmitted.
For PARM=, you can specify any parameter that is valid when invoking FTP from your terminal.

You must include the following three DD statements:

SYSPRINT DD: Alternative name for the OUTPUT DD statement. You can use SYSPRINT DD in place of the OUTPUT DD statement.
OUTPUT DD: Specifies the data set where FTP is to place the client messages and server replies generated during the FTP session.
INPUT DD: Specifies the data set where the FTP subcommands to be performed are located.

Any client messages and server replies to the commands you execute appear in the OUTPUT DD data set. The SYSPRINT can contain some additional messages that relate to the execution of your FTP session.

Note: If you do not want your password to be copied to the output file, specify your user ID and password on separate input lines as shown in the above example.

Following example uses GDG as the target dataset.


XX00       M0001.EDW.TEST.JCL(DW646A0U) - 02.07           Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000001 //TESTSUKU JOB (EWDS),'FTP TEST'                                       
000002 //DW646S04 EXEC PGM=FTP,REGION=6144K,                                  
000003 //         PARM='199.145.85.37 (EXIT TIMEOUT 720'                      
000004 //SYSPRINT DD SYSOUT=*                                                 
.JCPA  //OUTPUT   DD SYSOUT=*                                                  
000006 //INPUT    DD *                                                        
000007  M0001                                                                
000008  jan8th                                                                 
000009  put 'CMN.TEST.BASO.SRC(TEST111A)' 'M0001.src(+1)'                    
000010  quit                                                                  
****** **************************** Bottom of Data ****************************



After successful execution of the job following is what gets displayed in the output:

***************************** Top of Data ******************************
 EZA1736I FTP 199.145.85.37 (EXIT TIMEOUT 720                          
 EZY2640I Using /etc/ftp.data for local site configuration parameters. 
 EZA1450I IBM FTP CS V1R12                                              
 EZA1772I FTP: EXIT has been set.                                      
 EZA1554I Connecting to:   199.145.85.37 port: 21.                     
 220-FTPSERVE IBM FTP CS V1R12 at MVSXX00.MVS.ABC.COM, 15:20:48 on 1453-
 220 Connection will close if idle for more than 5 minutes.            
 EZA1459I NAME (199.145.85.37:M0001):                                 
 EZA1701I >>> USER M0001                                              
 331 Send password please.                                              
 EZA1789I PASSWORD:  <note that password was not displayed>                                                  
 EZA1701I >>> PASS                                                     
 230 M0001 is logged on.  Working directory is "M0001.".             
 EZA1460I Command:                                                     
 EZA1736I  put 'CMN.TEST.BASO.SRC(TEST111A)' 'M0001.src(+1)'          
 EZA1701I >>> SITE FIXrecfm 80 LRECL=80 RECFM=FB BLKSIZE=27920         
 200 SITE command was accepted  < note that implicit SITE command was generated. We can also execute the SITE command explicitly to specify the dataset attributes>                                        
 EZA1701I >>> PORT 199,145,86,233,73,152                               
 200 Port request OK.                                                  
 EZA1701I >>> STOR 'M0001.src(+1)'                                    
 125 Storing data set M0001.SRC.G0001V00                              
 250 Transfer completed successfully.                                  
 EZA1617I 314528 bytes transferred in 0.005 seconds.  Transfer rate 6402
 EZA1460I Command:                                                      
 EZA1736I  quit                                                        
 EZA1701I >>> QUIT                                                     
 221 Quit command received. Goodbye.                                   
**************************** Bottom of Data ****************************


In following example the remote server name is not passed as PARM, instead written as the 1st line on the input dataset

***************************** Top of Data ******************************
//TESTSUKU JOB (EWDS),'FTP TEST'                                       
//DW646S04 EXEC PGM=FTP,REGION=6144K,                                  
//         PARM=' (EXIT TIMEOUT 720'                                   
//SYSPRINT DD SYSOUT=*                                                 
//OUTPUT   DD SYSOUT=*                                                 
//INPUT    DD *                                                        
 MVSXX00.MVS.ABC.COM                                                   
 M0001                                                                
 jan8th                                                                 
 put 'CMN.TEST.BASO.SRC(TEST111A)' 'M0001.src(+1)'                    
 quit                                                                  
**************************** Bottom of Data ****************************



NOte : All the information about FTP and the syntax diagrams are taken from the site http://publib.boulder.ibm.com.
Things are put here in simplified words and Many commands that are not used normally are omitted.
Refer the website http://publib.boulder.ibm.com. in case you need more details.

No comments:

Post a Comment