Page 1 of 1

condition code in jcl

PostPosted: Sat May 07, 2016 5:58 pm
by arya_starc

//testjob jcl  msgclass=x,class=w
//step1 exec pgm=sort,cond(0,ne)
//...
//...
//step2 exec pgm=idcms,cond(4,ne)
//...
//...
 

If the step1 return code cam as 4 then step 2 should be executed but in my case it is getting skip and showing flush in the spool.
Kindly correct me if i am wrong

Re: condition code in jcl

PostPosted: Sat May 07, 2016 6:50 pm
by Aki88
Hello,

Are you sure the JCL shown by you here doesn't fail with 'JCL Error'?

Also:
a. Can you please show us the JESMSGLG where the step shows as flushed.
b. In conjunction to this, please confirm if the IEFBR14 step in question is the immediate step after your SORT step.
c. Lastly and most importantly please confirm the RC of the SORT step.

Re: condition code in jcl

PostPosted: Sat May 07, 2016 7:39 pm
by steve-myers
As aki88 noted the topic starter's JCL will not run. Ever. Period. Full stop. End of story.

I prepared and ran this JCL, with a proper JOB statement, of course. The SETCC program just returns with a return code equal to the contents of the PARM. It's a useful tool to check things like this.
//JOBLIB   DD  DISP=(SHR,PASS),DSN=&SYSUID..LOAD
//A       EXEC PGM=SETCC,PARM=4,COND=(0,NE)    
//B       EXEC PGM=SETCC,PARM=0,COND=(4,NE)

The first step ran, of course, and finished, as expected, with RC = 4.

IEF142I XXXXXXX A - STEP WAS EXECUTED - COND CODE 0004

The second step also ran, and finished with RC = 0.

IEF142I XXXXXXX B - STEP WAS EXECUTED - COND CODE 0000

Re: condition code in jcl

PostPosted: Sun May 08, 2016 12:50 am
by willy jensen
You really need to look at the JCL manual for condition code checking, it iscounter-intuitive.

cond(4,ne) means bypass this step if max cond != 4
and as maxcc so far is 4 it means that step 2 will run.

I'd like to do nasty things to whomever designed the condition code checker.
My recommendation is to use the IF/END JCL statement.

Re: condition code in jcl

PostPosted: Sun May 08, 2016 2:46 pm
by prino
I'd like

  • to see this thread moved to the correct forum, and
  • closed
as a simple lookup in the manuals would have told the TS everything he needs to know!

Re: condition code in jcl

PostPosted: Sun May 08, 2016 4:57 pm
by enrico-sorichetti
moved and locked !