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

How to Trap the abends in JCL


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

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Sat Nov 19, 2005 2:49 pm
Reply with quote

Hi All,

How can I trap abends in JCL? Give the exact JCL please.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Sat Nov 19, 2005 9:37 pm
Reply with quote

I suppose that you must use a program that get each return code of all step and run with a cond=even.
If you search in this forum you will find some question already threated.

I hope in this help
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Tue Nov 22, 2005 9:55 am
Reply with quote

Hi MGIndaco,

Thanks for your reply... I will search for the information in the forum.

If I still find some problems with the issue I will get back to you.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Nov 22, 2005 10:09 am
Reply with quote

hi frnd,
I think LASTCC in the steps will help to trap the abend codes in the JCL. Try it out. Let me know.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Mon Dec 12, 2005 8:51 am
Reply with quote

Hi All,

As a follow up to the previous posts, I am just adding some more information on how to trap abends in JCL.

The solution is
Use IF ABEND statement in the JCL.

Can anyone tell me how to use IF ABEND statement in JCL.


Correct me if I am wrong.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Mon Dec 12, 2005 10:37 am
Reply with quote

Hi frnd,

Try this

Code:
//IFBAD IF (ABEND OR STEP1.RC GT 8) THEN
//TRUE EXEC PROC=ERROR
//IFBADEND ENDIF
//NEXTSTEP EXEC PROC=CONTINUE


i think the above code helps u....
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Mon Dec 12, 2005 11:10 am
Reply with quote

Hi khamurutheen,

Thanks for your information.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Sat Dec 17, 2005 2:38 pm
Reply with quote

Hi All,

Some more information on how to trap abends+errors in JCl.

There are many types of JCL errors. Some are due to invalid syntax and are flagged by JES at job submission time prior to execution. Others, such as lack of DASD space or out of space conditions, happen prior to or during step execution and are also called JCL errors.

I think what you want to do at a minimum is look at the COND parameter of the EXEC JCL statement. But I highly recommend using conditional JCL processing statements (IF/THEN/ELSE/ENDIF) instead. They are much easier to understand and are more flexible than using COND. Even though the conditional JCL statements have been around since before OS/390 (since MVS/ESA V4), I find most people still don't use them, especially in their "legacy" production JCL.

Here are some conditional JCL examples related to abends (condition codes can also be checked just like on the COND statement):

Code:
//STEP1      EXEC PGM=MYPROG1
  //           IF    (ABEND=TRUE)   THEN
  //ERROR1     EXEC  PGM=CLEANUP
  //           ENDIF
  //NEXTSTEP   EXEC  PGM=MYPROG2



     //STEP2      EXEC PGM=MYPROG1
     //           IF    (ABENDCC=S0C7)   THEN
     //ERROR2     EXEC  PGM=BADDATA
     //           ENDIF
     //NEXTSTEP   EXEC  PGM=MYPROG2


For more information please see the following JCL manuals:
    MVS JCL Reference
    MVS JCL User's Guide
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 Batch call online program, EXCI task ... CICS 3
No new posts Recovery Routine/Abend exit to releas... PL/I & Assembler 14
No new posts Trap a CP command message in Rexx zVM CLIST & REXX 1
No new posts Abends using up address spaces? ABENDS & Debugging 6
No new posts Trap the jcl error message or maxcc i... CLIST & REXX 5
Search our Forums:

Back to Top