Page 1 of 1

Conditions in jcl.

PostPosted: Mon Apr 05, 2010 1:04 pm
by parasakthi
Hi,

I have following condition in jcl. I want to execute the step 3150 only if the return codes of the step2400 is 04 or 08. The following code is working. But i want to change the code to NE conditions with returns code 4,8(like, 04,NE,GCP20.STEP2400....).. Can you please help me?

//STEP3150 EXEC PGM=IEBGENER,
// COND=((00,EQ,GCP20.STEP2400),(12,EQ,GCP20.STEP2400),
// (16,EQ,GCP20.STEP2400))
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=IDD6201.PROG.EMPTY999,DISP=SHR
//SYSUT2 DD DSN=&TRANMIT..&COM..INSQUOT(+1),DISP=OLD
//*


Thank you,
Parasakthi N

Re: Conditions in jcl.

PostPosted: Mon Apr 05, 2010 4:09 pm
by Robert Sample
From the JCL Language Reference manual:
If any of the test conditions are satisfied, the system evaluates the COND parameter as true and bypasses the job step.
So if you code COND=((04,NE,GCP20.STEP2400),(08,NE,GCP20.STEP2400)) and the return code from STEP2400 is 04 then the second test is satisfied (since 04 is not 08) and the step will be bypassed. Similarly, if the return code from STEP2400 is 08 then the first test is satisfied (since 08 is not 04) and again the step will be bypassed. And if the return code from STEP2400 is anything else, both tests will be satisfied and the step will be bypassed.

In other words, if you want to use NE for two codes on the same step, you are guaranteed to NEVER execute the step. This is not something that can be changed as it is inherent with the way the COND testing works.

Re: Conditions in jcl.

PostPosted: Mon Apr 05, 2010 11:36 pm
by dick scherrer
Hello and welcome to the forum,

NOT and OR on a common "field" should be avoided everywhere. . . This causes problems with programming languages as well as problems with JCL. . .

' If fieldA not = "A" or fieldA not = "B" . . .' will be "not =" for every value that will ever pass thru the code. . .