Code condition whith ABEND and Cancel



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Code condition whith ABEND and Cancel

Postby samb01 » Fri Jun 16, 2017 7:51 pm

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.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Code condition whith ABEND and Cancel

Postby Robert Sample » Fri Jun 16, 2017 8:19 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Code condition whith ABEND and Cancel

Postby samb01 » Mon Jun 19, 2017 9:27 pm

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 ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Code condition whith ABEND and Cancel

Postby prino » Mon Jun 19, 2017 9:54 pm

Use if-then-else logic and RTFM
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: Code condition whith ABEND and Cancel

Postby NicC » Mon Jun 19, 2017 10:22 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Code condition whith ABEND and Cancel

Postby samb01 » Mon Jun 19, 2017 11:18 pm

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 ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Code condition whith ABEND and Cancel

Postby steve-myers » Mon Jun 19, 2017 11:38 pm

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."
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Code condition whith ABEND and Cancel

Postby samb01 » Tue Jun 20, 2017 7:20 pm

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 ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Code condition whith ABEND and Cancel

Postby samb01 » Tue Jun 20, 2017 8:23 pm

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
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Code condition whith ABEND and Cancel

Postby Robert Sample » Tue Jun 20, 2017 8:37 pm

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.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post