IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Trap FTP return code


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jain.eti

New User


Joined: 23 Jan 2007
Posts: 25
Location: delhi

PostPosted: Fri Oct 10, 2008 12:27 am
Reply with quote

Hi,
I have to FTP my file from mainframe to WINDOWS server. I am using the following JCL to do the same but the problem is - even if the FTP fails, MAXCC from JCL is always kept zero. So looking at the MAXCC, I can not get an idea whether my FTP ran successfully. Can you please let me know the way to trap return-code from FTP processing so that I can set that for my JCL return-code. For details, refer my JCL below -
Code:
//STEP001   EXEC PGM=FTP,REGION=5M                       
//SYSPRINT  DD SYSOUT=*                                   
//OUTPUT    DD SYSOUT=*                                   
//FTPIN     DD DSN=mainframe file,   
//          DISP=SHR,                                     
//          UNIT=3490,VOLUME=(,RETAIN,,,SER=(444226)),   
//          RECFM=VBA,LRECL=240,BLKSIZE=32760             
//SYSPRINT  DD SYSOUT=*                                   
//SYSOUT    DD SYSOUT=*                                   
//SYSDUMP   DD SYSOUT=*                                   
//INPUT     DD *                                         
ip address                                     
Username
Password
CD FTP_DL                                 
PUT //DD:FTPIN Windows file-name 
QUIT                                     
/*                                       
/*                                       
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 10, 2008 12:34 am
Reply with quote

Rather than posting the fairly useless (for solving your problem at least) JCL, why don't you post an actual output showing the FTP output as well as the JES messages showing the return code for the FTP step? And post one that didn't work so we can have something to work with. Replace the key data like IP address with * to keep it hidden, but give us the actual data to look at. Thanks.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Fri Oct 10, 2008 12:40 am
Reply with quote

Why aren't you using the EXIT parameter as described in the FTP Guide?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 10, 2008 12:47 am
Reply with quote

Kevin, I was heading there (slowly). As the guide says,
Quote:
By default, the FTP client ignores any errors that occur during a session and exits with a return code of zero.

Jain.eti: since you're connecting to a Windows server, the mainframe is a client in this case. As you've specified the job, you will ALWAYS get a zero return code (or MAXCC as you call it).
Back to top
View user's profile Send private message
jain.eti

New User


Joined: 23 Jan 2007
Posts: 25
Location: delhi

PostPosted: Fri Oct 10, 2008 6:21 pm
Reply with quote

Robert for you - refer the output message we got in the spool -
Code:
EZA1736I FTP                                                                   
EZY2640I Using dd:SYSFTPD=PSCZAYC.TCPPARMS(FTPDATA) for local site configuration
EZA1450I IBM FTP CS V1R7                                                       
EZA1466I FTP: using TCPIP                                                       
EZA1456I Connect to ?                                                           
EZA1736I 10.131.133.43                                                         
EZA1554I Connecting to:   10.131.133.43 port: 21.                               
EZA2589E Connection to server interrupted or timed out. Initial connection     
EZA1460I Command:                                                               
EZA1618I Unknown command: 'if(rc'                                               
EZA1619I For a list of the available commands, say HELP                         
EZA1460I Command:                                                               
EZA1736I LSMASTER\PARGYRIS                                                     
EZA1618I Unknown command: 'lsmaster\pargyris'                                   
EZA1460I Command:                                                               
EZA1736I earie444                                                               
EZA1618I Unknown command: 'earie444'     
EZA1460I Command:                                 
EZA1736I CD FTP_DL                               
EZA1457I You must first issue the 'OPEN' command 
EZA1460I Command:                                 
EZA1736I PUT //DD:FTPIN DLY@EVTS-20080505-0015.TXT
EZA1457I You must first issue the 'OPEN' command 
EZA1460I Command:                                 
EZA1736I QUIT                                     

By the way, I manipulated a random IP so that this JCL does not touch our production server and replace the file present on the server.

I am going thru the link sent by Superk, but Robert, did you mean by your comment -
Quote:
Jain.eti: since you're connecting to a Windows server, the mainframe is a client in this case. As you've specified the job, you will ALWAYS get a zero return code (or MAXCC as you call it).

- that we can not trap the FTP return code so that we can populate the code to JCL return code?
Back to top
View user's profile Send private message
jain.eti

New User


Joined: 23 Jan 2007
Posts: 25
Location: delhi

PostPosted: Fri Oct 10, 2008 6:34 pm
Reply with quote

Superk, as mentioned by you to use EXIT command, I used the command but received the following output in the spool -
Code:
EZA1736I FTP                                                                   
EZY2640I Using dd:SYSFTPD=PSCZAYC.TCPPARMS(FTPDATA) for local site configuration
EZA1450I IBM FTP CS V1R7                                                       
EZA1466I FTP: using TCPIP                                                       
EZA1456I Connect to ?                                                           
EZA1736I 10.138.100.51                                                         
EZA1554I Connecting to:   10.138.100.51 port: 21.                               
220-Microsoft FTP Service                                                       
220 Tufts Medical Center                                                       
EZA1459I NAME (10.138.100.51:PSCZAYC):                                         
EZA1701I >>> USER LSMASTER\PARGYRIS                                             
331 Password required for LSMASTER\PARGYRIS.                                   
EZA1789I PASSWORD:                                                             
EZA1701I >>> PASS                                                               
530 User LSMASTER\PARGYRIS cannot log in.                                       
EZA1460I Command:                                                               
EZA1736I CD FTP_DL                                           
EZA1701I >>> CWD FTP_DL                                     
530 Please login with USER and PASS.                         
EZA1460I Command:                                           
EZA1736I EXIT                                               
EZA1618I [b]Unknown command: 'exit'[/b]                             
EZA1619I For a list of the available commands, say HELP     
EZA1460I Command:                                           
EZA1736I QUIT generated by unexpected end of file           
EZA1701I >>> QUIT                                           
221  Leaving the MFrame Environment                         

Refer the output - you will see that FTP fails to understand the command. How is it possible? Am I missisng something?

Guys, I am in bad shape, pls help me out ...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 10, 2008 6:43 pm
Reply with quote

Code:
//STEP001   EXEC PGM=FTP,REGION=5M,PARM='(EXIT'     
It's not an FTP command, it's a parameter passed to FTP. If you leave the PARM='(EXIT' off your JCL, you will always get a zero return code from a client FTP. If you add it, the FTP return code in the JCL will be the 5-digit FTP code (2 digit command code and 3 digit response code), converted into a return code. For example, a GET fails with a FILE NOT FOUND message. This translates into an FTP code of 16550. 16550 modulo 4096 is 0166, which will be the return code for the FTP step.
Back to top
View user's profile Send private message
jain.eti

New User


Joined: 23 Jan 2007
Posts: 25
Location: delhi

PostPosted: Fri Oct 10, 2008 6:45 pm
Reply with quote

Guys sorry for the confusion raised by me - I am sorry! icon_redface.gif icon_neutral.gif
I checked with some other post in this forum itself and found out the actual syntax of EXIT.
For your info, I modified the JCL in the following way -
Code:
//STEP001   EXEC PGM=FTP,PARM='10.138.100.51 21 (EXIT=8'             
//SYSPRINT  DD SYSOUT=*                                   
//OUTPUT    DD SYSOUT=*                                   
//FTPIN     DD DSN=mainframe file,   
//          DISP=SHR,                                     
//          UNIT=3490,VOLUME=(,RETAIN,,,SER=(444226)),   
//          RECFM=VBA,LRECL=240,BLKSIZE=32760             
//SYSPRINT  DD SYSOUT=*                                   
//SYSOUT    DD SYSOUT=*                                   
//SYSDUMP   DD SYSOUT=*                                   
//INPUT     DD *                                                                               
Username
Password
CD FTP_DL                                 
QUIT                                     
/*                                       
/*                       


But as I mentioned earlier, I am not very much clear from the previous discussion whether this will populate the return-code of JCL if the FTP does not run successfully?

Wish to hear from u ...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top