IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

RUN keyword in IF statement


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

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Mon Jun 17, 2013 5:25 pm
Reply with quote

Hi,
I have a requirement to execute a step only if a certain previous step is not executed. I have used the below JCL for this

//REXXSUCC EXEC PGM=IKJEFT01
.
.
//CHECK IF NOT(REXXSUCC.RUN) THEN
//REXXFAIL EXEC PGM =IKJEFT01
.
.
// ENDIF

However, whenever the step 'REXXSUCC' gets flushed (not executed), the step 'REXXFAIL' also does not get executed. Any idea why this is happening? I am not sure how to check the result of the expression NOT(REXXSUCC.RUN)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Jun 17, 2013 5:50 pm
Reply with quote

The system distinguishes between "flushed" (as in a JCL error caused the job to not proceed and the step not to start execution) and "not executed" (as in the step did not meet the COND / IF requirements). You might be able to use ABEND in your IF statement to account for that condition (depending, of course, on why the step flushed -- a time out or operator cancel, for example, means that your REXXFAIL step will not execute under any circumstances).
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jun 18, 2013 4:35 am
Reply with quote

Hi,

please show the entire job output (including job card)

There must be another step before the REXXSUCC step, otherwise step REXXSUCC would execute.

I ran this and got correct results

Code:
//STEP0001 EXEC PGM=IDCAMS                           
//SYSPRINT DD SYSOUT=*                               
//SYSIN    DD *                                       
  SET MAXCC=4                                         
//CHECK01  IF (STEP0001.RUN)                         
//         &  (STEP0001.RC = 0) THEN                 
//REXXSUCC EXEC PGM=IEFBR14                           
// ENDIF                                             
//CHECK IF NOT(REXXSUCC.RUN) THEN                     
//REXXFAIL EXEC PGM=IEFBR14                           
// ENDIF                                             


although I prefer this

Code:
//*                                                     
//STEP0001 EXEC PGM=IDCAMS                             
//SYSPRINT DD SYSOUT=*                                 
//SYSIN    DD *                                         
  SET MAXCC=4                                           
//*                                                     
//CHECK01  IF (STEP0001.RUN)                           
//         &  (STEP0001.RC = 0) THEN                   
//REXXSUCC EXEC PGM=IEFBR14                             
//CHECK01  ENDIF                                       
//*                                                     
//CHECK02  IF (REXXSUCC.RUN = FALSE) THEN               
//REXXFAIL EXEC PGM=IEFBR14                             
//CHECK02  ENDIF                                       
//*                                                     



Gerry
Back to top
View user's profile Send private message
Vivek Anand

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Tue Jun 18, 2013 5:30 pm
Reply with quote

Hi Robert/Gerry,
Thanks for your valuable suggestion. I now understand why the step REXXFAIL was not getting executed. The previous step was resulting in an abend (RC - S806) due to incorrect load module. As Robert suggested, it looks like the System chose not to execute any subsequent steps and hence REXXFAIL was also not getting executed.

Gerry,
As you suggested, i have now replaced the previous step with one that gives a return code like 8 or 16 and now REXXFAIL is getting executed. I shall replace the statement with 'REXXSUCC.RUN = FALSE'.
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

 

Search our Forum:

Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. Splice JCL into one record for DD sta... SYNCSORT 2
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts CALL statement in COBOL for VSE COBOL Programming 3
No new posts ISPF skeleton that has IF/THEN/DO sta... TSO/ISPF 15
No new posts Usage of pre-processor statement in p... PL/I & Assembler 1

Back to Top