How to skip steps in PROC on restart with IF?

JES2/3, JCL, utilities.
Post Reply
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

How to skip steps in PROC on restart with IF?

Post by Anil »

Hi,

I needed to restart an abended Job. The looks like this

Code: Select all

//STEP1... 
// IF (STEP1.RC = 0) THEN 
//STEP2 ... 
//STEP3 ... 
//STEP4.. 
// ENDIF 
I want to skip STEP1 and STEP2 on the restart and execute only step3 and step4. I tried using, RESTART=STEP3 at end of Job-card. But what I observe is that since STEP1 not executed, STEP1.RC doesn't have any value and so STEP3 does not execute and SYSOUT shows:

Code: Select all

STEP WAS NOT RUN BECAUSE OF CONDITIONAL EXPRESSION
Please suggest a way to overcome this? :?
Thanks,
Anil
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: How to skip steps in PROC on restart with IF?

Post by nicc »

Refer to the JCL LAnguage Reference manual and in particular RESTART.
Regards
Nic
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: How to skip steps in PROC on restart with IF?

Post by zprogrammer »

Quoting from the manual
20.23.4 Cautions when Coding the RESTART Parameter


Before resubmitting a job:


Check all backward references to steps before the restart step. Eliminate all backward references in EXEC statement PGM parameters and DD statement VOLUME=REF parameters.

Review all EXEC statement COND parameters. If any of the COND parameters reference a step before the restart step, be aware that the system ignores the return code tests for those steps. See "Considerations when Using the COND Parameter" in topic 16.5.6 for more information.

Note that the stepname and procstepname specified to identify the restart step must be unique within the job. Otherwise, the system will not be able to determine the correct restart step. Results will be unpredictable.

Review all IF/THEN/ELSE/ENDIF structures. If a relational expression references a step that is bypassed by the RESTART keyword, the system evaluates that part of the expression as false
zprogrammer
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

Re: How to skip steps in PROC on restart with IF?

Post by Anil »

That means with COND I can not bypass the IF statement?

So to do a restart in such a sitatuon the only way out is to edit the job to remove the IFs before submitting? This is TEST region so I can do it and that's what I did but will we need to this in production also? If that, that's a horrible thing! :evil:
Thanks,
Anil
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: How to skip steps in PROC on restart with IF?

Post by William Collins »

I'm not sure what you mean by that, but No. It means that if a COND or IF refers to a STEP which is bypassed by the RESTART, then the part of the condition relating to that bypassed step is considered to be true. You don't have to worry about COND or IF, but you must not expect them to know that in the previous run STEP0003 had CC/RC=4. If they need to know that in the RESTART, it is up to you to inform them manually.
Anil
Registered Member
Posts: 70
Joined: Sun Jun 16, 2013 12:41 am

Re: How to skip steps in PROC on restart with IF?

Post by Anil »

William Collins wrote:I'm not sure what you mean by that, but No. It means that if a COND or IF refers to a STEP which is bypassed by the RESTART, then the part of the condition relating to that bypassed step is considered to be true. You don't have to worry about COND or IF, but you must not expect them to know that in the previous run STEP0003 had CC/RC=4. If they need to know that in the RESTART, it is up to you to inform them manually.
This is what I did not get that there is a manual part involved, like you said - but you must not expect them to know that in the previous run STEP0003 had CC/RC=4. If they need to know that in the RESTART, it is up to you to inform them manually.

Thank you.
Thanks,
Anil
Blackthorn
New Member
Posts: 8
Joined: Tue Jun 23, 2015 4:25 pm

Re: How to skip steps in PROC on restart with IF?

Post by Blackthorn »

We have used the ¬RUN test successfully in this scenario, in conjunction with your existing IF test. If the first step hasn't run due to the restart, the condition will still be true and your subsequent steps can run.

Alternatively, what scheduler are you using? TWS can be configured to retain step completion codes when a job fails, and when restarting it the JES control blocks will be manipulated to simulate those return codes for the step(s) that did not run. Thus your IF/THEN statements will still work. I daresay other schedulers have similar functionality.
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.”