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

JCL COND CODE check


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

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Tue Jun 26, 2018 7:43 pm
Reply with quote

Hi everyone!
(silly (?) question)
I am trying to prove some things I had as true.
I mean, in a job, the greatest COND CODE produced is the current one we have to compare. Please check the job I have ran checking COND CODE:
Code:

//CONDCOD1  EXEC PGM=IDCAMS                                             
//SYSPRINT  DD SYSOUT=*                                                 
//SYSIN     DD *                                                       
 SET MAXCC=5                                                           
//*                                                                     
//CONDCOD2  EXEC PGM=IDCAMS                                             
//SYSPRINT  DD SYSOUT=*                                                 
//SYSIN     DD *                                                       
 SET MAXCC=10                                                           
//*                                                                     
//*                                                                     
//CHECK001  EXEC PGM=IEFBR14,COND=(0,NE)                               
//*                                                                     
//CHECK002  EXEC PGM=IEFBR14,COND=(1,NE)                               
//*                                                                     
//CHECK003  EXEC PGM=IEFBR14,COND=((3,NE,CONDCOD1),(6,NE,CONDCOD2))     
//*                                                                     
//CHECK0A3  EXEC PGM=IEFBR14,COND=((5,NE,CONDCOD1),(6,EQ,CONDCOD2))     
//*                                                                     
//CHECK004  EXEC PGM=IEFBR14,COND=(3,NE,CONDCOD1)                       
//*                                                                     
//CHECK005  EXEC PGM=IEFBR14,COND=(3,GT,CONDCOD1)                       
//*                                                                     
//CHECK006  EXEC PGM=IEFBR14,COND=(6,GT,CONDCOD2)                       
//*                                                                     
//CHECK007  EXEC PGM=IEFBR14,COND=(11,LT)                               
//*                                                                     
//CHECK008  EXEC PGM=IEFBR14,COND=(7,GT)                               
//*                                                                     
//CHECK009  EXEC PGM=IEFBR14,COND=(7,GT,CONDCOD1)                       
//*                                                                     
//CHECK010  EXEC PGM=IEFBR14,COND=(7,GT,CONDCOD2)                       
//*                                                                     
//CHECK011  EXEC PGM=IEFBR14,COND=(5,GT)                               
//*                                                                     
//CHECK012  EXEC PGM=IEFBR14,COND=(3,GT)                               
//*                                                                     
//CHECK013  EXEC PGM=IEFBR14,COND=(2,GT,CONDCOD1)                       
//*                                                                     

Running that we have the result below:
Code:

CONDCOD1          IDCAMS   RC=0005
CONDCOD2          IDCAMS   RC=0010
CHECK001          IEFBR14  Flushed
CHECK002          IEFBR14  Flushed
CHECK003          IEFBR14  Flushed
CHECK0A3          IEFBR14  RC=0000
CHECK004          IEFBR14  Flushed
CHECK005          IEFBR14  RC=0000
CHECK006          IEFBR14  RC=0000
CHECK007          IEFBR14  RC=0000
CHECK008          IEFBR14  Flushed
CHECK009          IEFBR14  Flushed
CHECK010          IEFBR14  RC=0000
CHECK011          IEFBR14  Flushed
CHECK012          IEFBR14  Flushed
CHECK013          IEFBR14  RC=0000

My question is: why step "CHECK007" runs and "CHECK008" does not?

Thanks in advance!
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Tue Jun 26, 2018 7:54 pm
Reply with quote

Step CHECK008 is flushed because 7 is greater than the rc=000
of step CHECK007 (and several others).

As an aside, I find COND processing very confusing (ass-backwards logic).

The newer IF THEN ELSE construct is much more straight forward.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Jun 26, 2018 8:23 pm
Reply with quote

CHECK007 executes because the system evaluates 11 against all previous step condition codes and finds that none of them are greater than 11. Hence the step is NOT bypassed and executes.

CHECK008 does not execute because the system evaluates 7 against all previous step condition codes and finds that 7 is greater than at least one of them. Hence the step will be bypassed.

The JCL Reference manual (V2R3) on page 352 says
Quote:
If the return code issued by any of those previous steps causes the test condition to be satisfied, the system evaluates the COND parameter as true and bypasses the job step.
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Jun 26, 2018 10:38 pm
Reply with quote

NERTS

any are true, skip


Old school tip to results of processing cond=


As Dave suggested, IF THEN ELSE is way to go.
Back to top
View user's profile Send private message
juares castro

New User


Joined: 04 May 2012
Posts: 34
Location: Brazil

PostPosted: Tue Jun 26, 2018 11:43 pm
Reply with quote

Thanks everyone!
Robert, paying attention now, it seems very easy with your explanation.
It checks against all RC produced until the step.
Back to top
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Sat Aug 11, 2018 9:43 pm
Reply with quote

That might help those who find this to be confusing and has to deal with this format versus 'IF'.

Since we're on the subject, one thing I find that trips people up with COND= is that EVEN isn't always something you want to rely on, especially for non production applications you want to work without someone needing to check on things. Reason being is that jobs can fail in ways that immediate halt the job.

For this type of application, I submit some kind of checker job that will let me know if the job failed.

I still code EVEN, but I also run a checker job for non prod jobs or test jobs when I can't use a proper system that alerts someone failures.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top