Page 1 of 1
In a JCL, execute next step in case of System Abend.
Posted: Tue Sep 15, 2015 1:58 pm
by Sandy
Hi,
In a JCL of 2 steps I want to execute step2 only when return code of step1 is 12 or when there is a "system abend". Is that possible?
Code: Select all
//STEP1 EXEC PGM=PROG1
.
.
//STEP2 EXEC PGM=PROG2,COND=(12,GT,STEP1)
.
This is working fine when step1 returns 12 as return code. However when there is system abend, step2 does not execute. With COND=((12,GT,STEP1),ONLY), then it worked fine when there is a system abend. However when there is a return code 12, the step is not executing. Is there anyway we can execute step2 when there is an "System abend" or "return code 12"?
Re: In a JCL, execute next step in case of System Abend.
Posted: Tue Sep 15, 2015 4:18 pm
by nicc
Read the JCL Language Referance manual for conditional execution - COND (and IF/ELSE if you do not want to use COND).
Re: In a JCL, execute next step in case of System Abend.
Posted: Wed Sep 16, 2015 2:56 pm
by Sandy
I do not see a reference to handle the system abend even in IF/ELSE? Sorry if I miss to see something but do you think there is a soluction for the original question.
Re: In a JCL, execute next step in case of System Abend.
Posted: Wed Sep 16, 2015 7:37 pm
by nicc
Well, both my JCL Reference and User Guide explain how. And the Reference explains when it is NOT possible. I suggest you look up the index in both for the COND parameter and read the text pointed to. All of it.
Re: In a JCL, execute next step in case of Sytem Abend.
Posted: Mon Sep 21, 2015 3:09 pm
by Sandy
If I get what you are saying correctly, you are trying to refer to the COND=ONLY but then it does not work for RC=12. I need to make execute step2 when return code of step1 is 12 OR when there is a "system abend".
Re: In a JCL, execute next step in case of System Abend.
Posted: Mon Sep 21, 2015 3:39 pm
by William Collins
You can include both at the same time. Like nicc, I think there is an exact example in the JCL Reference. I could be wrong. Please check.
Re: In a JCL, execute next step in case of System Abend.
Posted: Mon Sep 21, 2015 5:54 pm
by nicc
RC=12 is NOT a system abend - it is a return code issued by a program. ABEND is short for ABnormal END and the job stops right there and then with a Uxxxx or Syyy code.
Re: In a JCL, execute next step in case of System Abend.
Posted: Sat Oct 03, 2015 1:37 pm
by Sandy
I am not able to follow you guys properly, found this in JCL guide, perhaps this is what you are referring to -
--
Testing for an Abend Condition: When a job step abends, the system scans the remaining steps for an IF/THEN/ELSE/ENDIF statement construct that tests for an abend or abend completion code. If none is present, the system terminates the job. Code one of the following to execute an error routine program after an abend:
Code: Select all
//IFBAD IF (ABEND) THEN
//ERROR EXEC PGM=ERRRTN
// ENDIF
//NEXTSTEP EXEC
or:
Code: Select all
//IFBAD IF (ABEND=TRUE) THEN
//ERROR EXEC PGM=ERRRTN
// ENDIF
//NEXTSTEP EXEC
The system executes step ERROR only when one or more of the preceding steps abnormally terminates.
--
But I want to execute thesame step in case of RC=12 or abend, both.
Re: In a JCL, execute next step in case of System Abend.
Posted: Wed Oct 07, 2015 8:27 pm
by nicc
I'm sure you can have multiple conditions for the IF.