View previous topic :: View next topic
|
Author |
Message |
sandeep kumar302
New User
Joined: 14 Mar 2012 Posts: 81 Location: India
|
|
|
|
Hi,
I have a JCL which gets the return code of 01 or 02 from the cobol program based on the program logic and if the return code is 01 or 02, the job should abend.
My doubt is that even though i am getting the return code of 2 from rogram the job is not getting abend. Can someone please help me-
JCL-
-----
Code: |
//PSTY0010 EXEC PGM=TESTNOFL,COND=(4,LT)
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYSIN DD DSN=CPISXK.TEST.SYSIN(CCCHECK),DISP=SHR
//*
//ABEND010 EXEC PGM=ABEND,
// COND=(3,GT,PSTY0010)
//*
//* -----------------------------------------------------------------
//* IF JOB FAILS AT THIS STEP, ENGAGE THE ON CALL SUPPORT PERSON
//* -----------------------------------------------------------------
//ABEND011 EXEC PGM=ABEND,
// COND=((1,NE,PSTY0010),(2,NE,PSTY0010))
//*
|
JESMSG
--------
Code: |
-JOBNAME STEPNAME PROCSTEP RC EXCP CONN TCB
-TESTNOFL PSTY0010 02 67 15 .00
-TESTNOFL ABEND010 FLUSH 0 0 .00
-TESTNOFL ABEND11 FLUSH 0 0 .00
|
Here setp ABEND11 should run and the job should abend?? |
|
Back to top |
|
|
sandeep kumar302
New User
Joined: 14 Mar 2012 Posts: 81 Location: India
|
|
|
|
Oh my apology. Actually one of the condition (1,NE,PSTY0010) is true so the condition will be true and the abend step will be bypassed. It has no flaw.
Sorry, my mistake here. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Your condition will always be TRUE
Code: |
(cc NE 1) or (cc NE 2)
CC = 0 => TRUE or TRUE => TRUE
CC = 1 => FALSE or TRUE => TRUE
CC = 2 => TRUE or FALSE => TRUE
CC = 3 => TRUE or TRUE => TRUE
----------------------------------
(cc LT 1) or (cc GT 2)
CC = 0 => TRUE or FALSE => TRUE
CC = 1 => FALSE or FALSE => FALSE
CC = 2 => FALSE or FALSE => FALSE
CC = 3 => FALSE or TRUE => TRUE
|
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Note that the z/OS MVS JCL Reference states:
Quote: |
If any of the test conditions are satisfied, the system evaluates the COND parameter as true and bypasses the job step |
My opinion is that the IF/THEN/ELSE construct is superior to the COND parameter. If you wish to make use of COND, however, code it as
Code: |
COND=(0,EQ,PSTY0010) |
|
|
Back to top |
|
|
sandeep kumar302
New User
Joined: 14 Mar 2012 Posts: 81 Location: India
|
|
|
|
Hi Akatsukami,
I also think that IF/THEN/ELSE is a better option than COND but in my organization IF condition is not allowed instead the standard is to follow COND.
And Yes, i later corrected my condition to COND=(0,EQ,PSTY0010) and it worked. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I also prefer the IF/THEN/ELSE construct, but as in sandeep's case IF is not allowed in production JCL here. I've heard that JCLs with IF are more difficult to deal with in case of restarts. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
Quote: |
I've heard that JCLs with IF are more difficult to deal with in case of restarts |
Not if you set the procedures up correctly in the first place. Takes a bit of thinking out but generally restarts can be handled cleanly. |
|
Back to top |
|
|
|