Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to handle the return codes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 51

PostPosted: Thu Jun 10, 2010 1:01 pm    Post subject: How to handle the return codes
Reply with quote

Hi,
I have a JCL with 20 unique functionaliy steps. In this process if the job fails at any step (RC > 0, ABEND) the job should trigger an email stating what failed (user defined messages based on the step failure).

Sample JCL is given below.
IF SORT1 fails EMAIL1 should execute
IF STEP01 fails EMAIL2 should execute
Issue1: Some times I get RC>0 and ABEND. I want to handle both (can be same user defined message)
//EMAIL1 EXEC PGM=IEBGENER,COND=((0,GE,SORT1),ONLY)
The SORT1 step failed with RC=08 but the EMAIL1 is not getting executed but when ONLY is removed EMAIL1 is executed.

Issue2: If the sort step abends then both the steps Email1 and Email2 are getting excuted based on the cond parameter ONLY.

Code:

//SORT1     EXEC  PGM=SORT,COND=(0,NE)                             
//SORTLIST DD  SYSOUT=Y                                           
//SYSOUT   DD  SYSOUT=Y                                           
//SORTIN  DD DISP=SHR,DSN=CT.DAT2.FTPUP                       
//SORTOUT  DD DSN=CT.DAT2.FTPUP.TAB(+1),                     
//            DSORG=PS,DISP=(NEW,CATLG,DELETE),                   
//            DCB=(LRECL=023,RECFM=FB),SPACE=(TRK,(20,20),RLSE)   
//SYSIN    DD  DSN=CT.TABLE.TOOLS(COPY),DISP=SHR             
//*                                                               
//EMAIL1   EXEC  PGM=IEBGENER,COND=((0,GE,SORT1),ONLY)             
//SYSPRINT DD  SYSOUT=*                                           
//SYSIN    DD  DUMMY                                               
//SYSUT2   DD  SYSOUT=(2,SMTP)                                     
//SYSUT1   DD  DSN=CT.TABLE.CONTROL2(MAILAWAY),DISP=SHR       
//         DD  DSN=CT.TABLE.CONTROL2(SRTFAIL),DISP=SHR       
/*         
//STEP01 EXEC PGM=IDCAMS,REGION=512K,COND=(0,NE)                   
//SYSPRINT DD SYSOUT=*                                               
//SYSIN   DD  DSN=CT.TABLE.TOOLS(CM140ODL),DISP=SHR             
//*                                                                   
//EMAIL2   EXEC  PGM=IEBGENER,COND=((0,GE,STEP01),ONLY)
//SYSPRINT DD  SYSOUT=*                                               
//SYSIN    DD  DUMMY                                                 
//SYSUT2   DD  SYSOUT=(2,SMTP)                                       
//SYSUT1   DD  DSN=CT.TABLE.CONTROL2(MAILAWAY),DISP=SHR         
//         DD  DSN=CT.TABLE.CONTROL2(DELFAIL),DISP=SHR           
/*                                                                                                                           


How can we handle the execution of remaining steps if the job abends?
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Jun 10, 2010 6:24 pm    Post subject:
Reply with quote

Probably, you can set some specific RC for your sort step (check for NULLOUT) and check the value of it in subsequent steps instead of checking if it is greater than 0.

Suggest you use IF THEN ELSE construct of JCL to execute steps conditionally - IF construct also gives the facility of executing steps conditionally when there is an abend in one of the previous steps, please have a look on the manuals for details.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 10, 2010 8:16 pm    Post subject:
Reply with quote

Hello,

Quote:
How can we handle the execution of remaining steps if the job abends?
Have you looked at COND EVEN?

Also, if you switch to if/then/else for condition code checking, you may not be able to easily support restarting. If this process is never to be restarted in the middle, it will not be an issue.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 669
Location: Pennsylvania

PostPosted: Thu Jun 10, 2010 8:47 pm    Post subject:
Reply with quote

If it were me, I would be more worried about the proper flow of the Job from a functionality standpoint.

That is to say, if a step gave a bad cond code, which other steps need to be run/skipped.

As far as an email for each step failure,I think this that is a waste of time. I would check at the end of the job for any bad cc and send a single email. Let the persons receiving the email figure out which step was bad (how tough can it be).

I know what you are going to say 'each step has a different person responsibilty for that functionality'

Well then your issue is with your job creator, mixing so many different functions or your management for not having a central support team.
Back to top
View user's profile Send private message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 51

PostPosted: Tue Jun 15, 2010 12:07 pm    Post subject:
Reply with quote

Thanks for the response.
IF THEN ELSE constructs has solved my issue. It doesnt need restarting.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts EXIT or RETURN cvnlynn CLIST & REXX 9 Wed Jul 19, 2017 2:50 am
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts MAX-RC 88 and Return code 606 in DFH0... lind sh CICS 2 Tue Jan 24, 2017 1:23 pm
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 2 Thu Jan 12, 2017 12:02 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us