In a JCL, execute next step in case of System Abend.

JES2/3, JCL, utilities.
Post Reply
Sandy
Registered Member
Posts: 51
Joined: Sat Jun 15, 2013 1:07 pm

In a JCL, execute next step in case of System Abend.

Post 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"?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: In a JCL, execute next step in case of System Abend.

Post by nicc »

Read the JCL Language Referance manual for conditional execution - COND (and IF/ELSE if you do not want to use COND).
Regards
Nic
Sandy
Registered Member
Posts: 51
Joined: Sat Jun 15, 2013 1:07 pm

Re: In a JCL, execute next step in case of System Abend.

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: In a JCL, execute next step in case of System Abend.

Post 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.
Regards
Nic
Sandy
Registered Member
Posts: 51
Joined: Sat Jun 15, 2013 1:07 pm

Re: In a JCL, execute next step in case of Sytem Abend.

Post 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".
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: In a JCL, execute next step in case of System Abend.

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: In a JCL, execute next step in case of System Abend.

Post 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.
Regards
Nic
Sandy
Registered Member
Posts: 51
Joined: Sat Jun 15, 2013 1:07 pm

Re: In a JCL, execute next step in case of System Abend.

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: In a JCL, execute next step in case of System Abend.

Post by nicc »

I'm sure you can have multiple conditions for the IF.
Regards
Nic
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”