Page 1 of 2

Code condition whith ABEND and Cancel

PostPosted: Fri Jun 16, 2017 7:51 pm
by samb01
Hello,

at the end of my jcl, there is :


//STEP001 EXEC PGM=IEBGENER,COND=ONLY
etc...

 


So i want this step execute if there is an ABEND and it works.

But when the job is canceled, i don't want the step executing. Is it possible to code that with condition code.

Re: Code condition whith ABEND and Cancel

PostPosted: Fri Jun 16, 2017 8:19 pm
by Robert Sample
Does the step execute when the job is cancelled? If you haven't tested this, you should because the MVS JCL Reference manual says:
Errors that prevent step execution, regardless of COND specifications

z/OS MVS JCL Reference
SA23-1385-00

Certain error conditions prevent the system from executing a step, regardless of any requests specified through the COND parameter. These conditions are as follows:
Abnormal termination by the system: After certain types of abnormal termination by the system, remaining job steps are not executed, regardless of whether EVEN or ONLY were specified. The completion codes associated with these types of abnormal termination are:

122
Operator canceled job
222
Operator or TSO/E user canceled job

You might encounter other system completion codes for which remaining job steps are not executed, regardless of whether EVEN or ONLY was specified. See z/OS MVS System Codes for further information about specific system completion codes.
If the job is being cancelled and STEP001 is executing, then you need to open a PMR with IBM since you have behavior contrary to the documentation.

Re: Code condition whith ABEND and Cancel

PostPosted: Mon Jun 19, 2017 9:27 pm
by samb01
Hello Robert Sample. You're right. With a cancel the step is not executing.
Buut i have an other problme. I would like the step is executing when there is an abend AND when then the Return Code is different than 1004. Is it possible ?

Re: Code condition whith ABEND and Cancel

PostPosted: Mon Jun 19, 2017 9:54 pm
by prino
Use if-then-else logic and RTFM

Re: Code condition whith ABEND and Cancel

PostPosted: Mon Jun 19, 2017 10:22 pm
by NicC
An abend does not give a return code. So are you saying that you want the step to run if there is an abend and some other step does not give a return code or are you saying that if the program abends then run your step but if it gives a return code of 1004 then do not execute. Or what? Anyway, use IF-THEN-ELE as per the JCL manuals.

Re: Code condition whith ABEND and Cancel

PostPosted: Mon Jun 19, 2017 11:18 pm
by samb01
Hello NicC, sorry for my english :

It is that :

If the program abends then run your step but if it gives a return code of 1004 then do not execute


but i have not only one program, there are several programs before my last step to be executed or not. So migt i tested all the step in the if statement ?

like this :

//IFBAD     IF  (ABEND | STEP1.RC NE 1004 | STEP1.RC NE 1004 | STEP2.RC NE 1004 | STEP3.RC NE 1004| STEP4.RC NE 1004| STEP5.RC NE 1004| STEP6.RC NE 1004| STEP7.RC NE 1004| STEP8.RC NE 1004| STEP9.RC NE 1004| STEP10.RC NE 1004| STEP11.RC NE 1004| etc...) THEN
//TRUE      EXEC  PROC=ERROR
//          ELSE
//IFBADEND  ENDIF
 


@prino, what is RTFM ?

Re: Code condition whith ABEND and Cancel

PostPosted: Mon Jun 19, 2017 11:38 pm
by steve-myers
RTFM = Read The Fine Manual. A different word, not usually considered suitable for a family oriented web site like this one, is frequently substituted for "fine."

Re: Code condition whith ABEND and Cancel

PostPosted: Tue Jun 20, 2017 7:20 pm
by samb01
Hello, in fact, i would my step is executing if the ABEND is U0750.
I don't want my step executing if a step before with a RC = 1004 AND if there is an ABEND U0100.

Is it possible to make a difference between the ABEND ?

Re: Code condition whith ABEND and Cancel

PostPosted: Tue Jun 20, 2017 8:23 pm
by samb01
example :

this code dosn't work :


//IFBAD     IF  (ABEND NE U0550) THEN

 


I have this error :

10 IEFC015I ERROR IN IF STATEMENT: INCOMPATIBLE TYPES IN A COMPARISON

Re: Code condition whith ABEND and Cancel

PostPosted: Tue Jun 20, 2017 8:37 pm
by Robert Sample
I recommend you start reading: https://www.ibm.com/support/knowledgece ... /ifuse.htm as you need to learn a LOT to use these constructs correctly.

You CANNOT say
IF ABEND NE U0550
-- period (as you have discovered). You could say
IF ^(ABENDCC = U0550)
(where the caret is the NOT symbol in the manual) but you can find this in the manual link I gave you. And, again, there are specific system completion codes (such as S122 or S222) that will ignore the IF condition.