View previous topic :: View next topic
|
Author |
Message |
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi All,
How can I trap abends in JCL? Give the exact JCL please. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
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 |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
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 |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi khamurutheen,
Thanks for your information. |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
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 |
|
|
|