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

Execute step regardless of previous step retun code


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

New User


Joined: 12 Jan 2021
Posts: 1
Location: US

PostPosted: Tue Jan 12, 2021 4:54 am
Reply with quote

There is a COND=[4,LT] on the Job Card.

I want to execute a step,
regardless of the return code of ONLY the previous step.

//STEP1 EXEC PGM=PROGRAM1
//STEP2 EXEC PGM=PROGRAM2 Execute regardless of RC for STEP1
//STEP3 EXEC PGM=PROGRAM3
//STEP4 EXEC PGM=PROGRAM4 Execute regardless of RC for STEP3

Can this be done without having to duplicate the step,
and testing separately for a good vs bad Return Code.

If STEP1 abends, I want STEP2 to execute and the job to end.

If STEP1 and 2 RC LT 4, and STEP3 Abends, execute STEP4.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2586
Location: NYC,USA

PostPosted: Tue Jan 12, 2021 8:56 am
Reply with quote

You set the RC of each step and use IF ENDIF conditions to control the processing.
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 947
Location: Maryland

PostPosted: Tue Jan 12, 2021 8:04 pm
Reply with quote

MainframeCoder wrote:
There is a COND=[4,LT] on the Job Card.

I want to execute a step,
regardless of the return code of ONLY the previous step.

//STEP1 EXEC PGM=PROGRAM1
//STEP2 EXEC PGM=PROGRAM2 Execute regardless of RC for STEP1
//STEP3 EXEC PGM=PROGRAM3
//STEP4 EXEC PGM=PROGRAM4 Execute regardless of RC for STEP3

Can this be done without having to duplicate the step,
and testing separately for a good vs bad Return Code.

If STEP1 abends, I want STEP2 to execute and the job to end.

If STEP1 and 2 RC LT 4, and STEP3 Abends, execute STEP4.

1. Remove COND= parameters from your JOB and EXEC statements. (BTW, your COND=[...] must give you syntax error)

2. Use appropriate combination of JCL statements
// IF
// ELSE
// ENDIF
It is more flexible, and provides more functionality compared to COND= parameters.
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 How to convert RESP code 12 to text? CICS 9
No new posts Error 0C1 Reason Code 1 with branch i... PL/I & Assembler 3
No new posts JCL for replacing code in Cobol JCL & VSAM 7
No new posts Easytrieve EZABX007 with error code 0... CA Products 7
No new posts Add a step counter in a stack ? CLIST & REXX 23
Search our Forums:

Back to Top