Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

RUN keyword in IF statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: RUN keyword in IF statement
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: 8121
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jun 17, 2013 5:50 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Jun 18, 2013 4:35 am    Post subject:
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    Post subject: Reply to: RUN keyword in IF statement
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us