My requirment is tosend a notification mail to a set of people whenever an abend occurs in a job. To do this, my job should execute till the end even if a sytem abend or user abend occurs(other than the standard Maxcc 4, 8 12 and 16 abends). Is there a way to do it? Please help
I tried using the COND = (EVEN/ONLY) parameter in the EXEC Statement.
It seems EVEN/ONLY works only during an abend. When we encounter error codes like RC=8 or Rc=12 or RC=5, the EVEn/ONLY parameter fails to execute the step. Can anyone help?
//LATE EXEC PGM=CLEANUP,COND=EVEN This example says 'Execute program CLEANUP even if one or more of the preceding steps abnormally terminated.'
Example 3
//LATER EXEC PGM=SCRUB,COND=((10,LT,STEPA),(20,EQ),ONLY) This example says 'Execute this step only if one of the preceding steps terminated abnormally; but bypass it if 10 is less than the return code STEPA issues or if any of the steps that terminated normally issued a return code of 20'.
Example 4
//LATEST EXEC PGM=FIX,COND=((10,LT,STEPA),(20,EQ),EVEN) This example says 'Bypass this step if 10 is less than the return code STEPA issues, or if any of the preceding steps issues a return code of 20; otherwise execute this step even if one of the preceding steps terminated abnormally'.
Lets say my job has 8 steps. The 5th step had return code 8 and the rest of the steps have return code zero. On my 7th step, I code the part to send mail in case of abends or errors.
//STEP07 EXEC PGM=IEBGENER, COND=((4,GT), EVEN)
//.....
//.....
//STEP8
But still I am not getting the notification mail.
Can anyone help?
I had a look into the IBM manual and the website as well but the program behaves in a way contradicting what they have given. This is how I understood the condition COND=((4,GT), EVEN)
"Bypass this step if 4 is greater than the return code issued by any other step. Otherwise execute this step even if there is any abnormal termination."
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
Quote:
Please correct if I am wrong
OK, no problems ........................... here we go.
COND=(4,GT) checks to see if ANY previous step returns a code of 4 or less than 4.
If ANY step returns a code of 4 or less than 4 then the condition is met and the step will not run.
EVEN specifies that the step is to process EVEN if an abend occurs.
So where we have COND=((4,GT),EVEN) the step will not process EVEN if an abend occurs but ANY step has issued a return code of 4 or less than 4, because the conditions to bypass the step have been met.
Hence my suggestion that you look at IF/THEN/ELSE processing, which is easier to code and understand, and allows much more flexibility in coding.
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
To emphasize what expat has suggested several times, please consider using the IF/THEN/ELSE/ENDIF construct. The folks who maintain what you have written will be very grateful.