Monika,

I found the following tidbit in the JCL reference:

By default, job steps within the IF/THEN/ELSE/ENDIF statement construct do not 
execute when

* An abend occurred, and

* the IF/THEN/ELSE/ENDIF structure containing the job steps does not specify 
the ABEND, ABENDCC, or ¬ABEND keyword. If any of these keywords is specified 
(with or without stepname or procstepname), the job steps do execute despite 
the abend.

 * The step's COND parameter, if any, does not specify an abend condition 
(COND=EVEN or COND=ONLY).

Note in the second asterisk (bullet) that it specifies "steps" (plural) in the 
THEN/ELSE structure. I interpret that as meaning that ALL steps after "IF ABEND 
THEN" are executed when an ABEND occurs unless overridden by a COND= (or nested 
IF). You can easily test this by adding the COND= to STEP06 or enclosing it in 
a nested IF.

Not very intuitive, I admit, but that's my interpretation of how it is supposed 
to work.

Regards,
Alan 



 

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf Of 
Monika Amiss
Sent: Wednesday, June 09, 2010 09:08
To: IBM-MAIN@bama.ua.edu
Subject: IF/ELSE/ENDIF strange behavior

Hello group,

 I'm running following job with z/OS 1.10 /JES3). Program MAKEABND
 (STEP04) produces an S0C1-Abend, and STEP06 is executed, which I  did not 
expect. If I put the ENDIF before STEP06, STEP06 is Flushed
 (like expected),    

//STEP01  EXEC PGM=IEFBR14                                       
//*                                                              
// IF ABEND THEN                                                 
//STEP02 EXEC PGM=IEFBR14                                        
// ELSE                                                          
//STEP03 EXEC PGM=IEFBR14                   
//*                          
//STEP04  EXEC PGM=MAKEABND,COND=(0,NE,STEP03)                   
//*                                                              
//STEP05  EXEC PGM=IEFBR14,COND=(EVEN)                           
//*                                                              
//STEP06  EXEC PGM=IEFBR14                                       
//  ENDIF    

Does somebody has an explanation fot this behaviour. Any hint appreciated.
With best regards
  Monika

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@bama.ua.edu with the message: GET IBM-MAIN INFO Search the archives at 
http://bama.ua.edu/archives/ibm-main.html

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to