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

JCL steps skipped on Restart due to IF condition


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

Active User


Joined: 21 May 2009
Posts: 139
Location: United States

PostPosted: Mon Jul 09, 2012 8:19 am
Reply with quote

All,
I came across a situationa as follows for the first time -
Here is sample JCL -
STEP1 EXEC FILEMGR

IF STEP1.RC=0

EXEC STEP2
EXEC STEP3 - BMP
EXEC STEP4

ENDIF

EXEC STEP5

My job abended in STEP3. When I did a step restart, it skipped STEP3 and STEP4 with an explanation that these steps are not executed due to condition code coded on line XYZ which is STEP1.RC=0. It was inside the IF already at time of abend !!
Only STEP5 was executed.

Is this how IF is supposed to behave, did it loose the RC of STEP1 while it abended.[/code]
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jul 09, 2012 8:35 am
Reply with quote

Have you read the JCL Reference manual on restarts and the IF statement? It specifically states that only automatic restarts retain condition information, and since you did a step restart instead of an automatic restart, I expect that the behavior you saw is precisely what would be expected of the system.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jul 09, 2012 9:19 am
Reply with quote

Hello,

When you step restarted the job, there were NO return codes available for any of the steps prior to the restart. This is possibly the biggest problem with using "IF" to check return codes. . .

As Robert mentioned, you need to invest time learning about restart and IF from the JCL Reference Manual (available via the "IBM Manuals" link at the top of the page).
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Jul 09, 2012 4:18 pm
Reply with quote

What you asked system to do is "deferred Restart" and not an "automatic restart" as Robert has talked about it.

IF STEP1.RC=0 "tests false" because STEP1 did not execute and cannot be correctly evaluated. You should have changed the IF as
Code:
IF STEP1.RC=0 | ¬STEP1.RUN THEN

EXEC STEP2
EXEC STEP3 - BMP
EXEC STEP4

ENDIF
EXEC STEP5
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 CA7 deleting files in steps after job... CA Products 4
No new posts How to give complex condition in JCL . CLIST & REXX 30
No new posts selectively copy based on condition DFSORT/ICETOOL 3
This topic is locked: you cannot edit posts or make replies. Control-m JOB executing even when the... Compuware & Other Tools 6
No new posts Dynamic condition checks COBOL Programming 5
Search our Forums:

Back to Top