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: 5
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: 3048
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

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

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 run rexx code with jcl CLIST & REXX 15
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top