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

How to handle the return codes


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
picus_mf
Warnings : 1

New User


Joined: 09 Jun 2006
Posts: 52

PostPosted: Thu Jun 10, 2010 1:01 pm
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

Superior Member


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

PostPosted: Thu Jun 10, 2010 6:24 pm
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

Moderator Emeritus


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

PostPosted: Thu Jun 10, 2010 8:16 pm
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: 792
Location: Pennsylvania

PostPosted: Thu Jun 10, 2010 8:47 pm
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: 52

PostPosted: Tue Jun 15, 2010 12:07 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts AI writing DFSORT, REXX codes.. All Other Mainframe Topics 3
No new posts REXX GETMSG does not return £HASP880... CLIST & REXX 2
No new posts RXSUBCOM Return Codes / Documentation CLIST & REXX 6
Search our Forums:

Back to Top