How to set return code of whole job to 0 ?



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

How to set return code of whole job to 0 ?

Postby swatmf14 » Fri Jan 02, 2015 11:35 am

I have some steps in my job which are getting abended. Depends on the return code of previous steps i am executing next steps. But at the end of execution of all steps i want to set return code of whole job to 0 even if steps are abended. Can anyone please help me on this ? i tried using IDCAMS utility but its not working.
swatmf14
 
Posts: 11
Joined: Fri Jan 17, 2014 10:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to set return code of whole job to 0 ?

 

Re: How to set return code of whole job to 0 ?

Postby Aki88 » Fri Jan 02, 2015 2:36 pm

Hello swatmf14,

Curious question, why would you want to set the Max-RC of a job to 0?

I am only guessing here- if it is because you don't want the job to fail in the job scheduler, then usually you can set the conditions in the scheduler itself to ignore certain RCs.

Alternatively, you might want to check here.

Hth!
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: How to set return code of whole job to 0 ?

Postby swatmf14 » Fri Jan 02, 2015 3:05 pm

I do not want it as the job should not abend in scheduler. As i want it for standardization purpose.
And in addition that steps are inside proc and i am accessing that steps through my job.
Is there any way to get this done by using JOBRC ?
swatmf14
 
Posts: 11
Joined: Fri Jan 17, 2014 10:06 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to set return code of whole job to 0 ?

Postby Aki88 » Fri Jan 02, 2015 3:18 pm

Hello,

It'd be better if you can explain what you want to do in a li'l more detail please.

swatmf14 wrote:As i want it for standardization purpose.
And in addition that steps are inside proc and i am accessing that steps through my job.


This is interesting, how would an RC impact the execution of a PROC in a JCL? RC is returned after the step has executed.
Incase you have multiple PROCs in a JCL and you want the subsequent PROCs to be executed even if a step in the previous PROC has given an unwanted RC, then it can be done by using return code handling using IF-THEN-ELSE constructs (I'm not a very big fan of COND parameter).

swatmf14 wrote:Is there any way to get this done by using JOBRC ?


There are various limiting factors here, starting with - which z/OS version you're on; if you have 1.13 or higher, then have a look at the link shared earlier, Mr.Spock and Enrico have posted links for the manuals, that should get you started; write a small JCL to test the same.
Then if you're stuck somewhere, please share what you've tried and we can guide you.
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: How to set return code of whole job to 0 ?

Postby Terry Heinze » Fri Jan 02, 2015 7:44 pm

JCL cannot set the RC for the entire job. It can only set it for the current step within a job. You cannot retroactivly modify the RC of a previous step.
.... Terry
Terry Heinze
 
Posts: 193
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: How to set return code of whole job to 0 ?

Postby Aki88 » Sat Jan 03, 2015 12:35 am

Hello Terry,

True that, but IBM has introduced JOBRC parameter in z/OS 1.13 to do just that.
From the 'JCL Reference':



“JOBRC Parameter” on page 404 is a new parameter on the JOB statement to
control how the job return code (presented by JES2 or JES3) is determined.

.....
.....

JOBRC Parameter
Parameter Type
Keyword, optional
Purpose
Use the JOBRC parameter to control how the job completion code (presented by
JES2 or JES3) is set. By default (when JOBRC is not specified), the job completion
code is set to the highest return code of any step, or if the job's execution fails
because of an ABEND, the job completion code is set to the last ABEND code;
however, this parameter can be used to request that the job completion code be set
to the return code of the last exe
Syntax
JOBRC= {MAXRC}
{LASTRC}
{(STEP,stepname[.procstepname]}


Subparameter Definition
MAXRC
The job completion code is set to the highest return code of any step in the job,
or if the completion of the job fails because of an ABEND, the job completion
code is set to the last ABEND code; This is the default parameter.
LASTRC
The job completion code is set to the return code or ABEND code of the last
step that is executed in the job.
(STEP,stepname[.procstepname])
The job completion code is set to the return code or ABEND code of the step
that is indicated by the stepname.[.procstepname] parameter. If this step does
not exist, a JCL error is generated. If this step does not execute, the processing
is the same as if MAXRC is specified. .
Defaults
If not specified, MAXRC is used as the default.

Examples of the JOBRC Parameter
Example 1
JOBRC=LASTRC
This specification indicates to use the return code of the last executed step as the
completion code for the job.

Example 2
JOBRC=(STEP,C.HLASM)
Use the return code for the C step in the HLASM procstepname as the completion
code for the job.


So if a simple IEFBR14 is added in the JCL to set a step return code '0', and JOBRC refers to this particular step, then the end RC can be set to a '0'; though imho, I'd still want to avoid doing this.
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: How to set return code of whole job to 0 ?

Postby Terry Heinze » Sat Jan 03, 2015 3:32 am

I stand corrected then. I'm having trouble finding the most recent manual for rel 1.13. Do you have a manual ID for it?
.... Terry
Terry Heinze
 
Posts: 193
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: How to set return code of whole job to 0 ?

Postby Aki88 » Sat Jan 03, 2015 12:32 pm

Hello Terry,

The manual I'm using is: SA22-7597-15
For z/OS 2.1: SA23-1385-00

z/OS 2.1 Link

Cheers.

These users thanked the author Aki88 for the post:
Terry Heinze (Sat Jan 03, 2015 8:37 pm)
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: How to set return code of whole job to 0 ?

Postby Terry Heinze » Sat Jan 03, 2015 8:37 pm

Thanks for the link. We're on z/OS 1.13 so it's not yet available to me. This is the 2.1 version.
.... Terry
Terry Heinze
 
Posts: 193
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 10 times
Been thanked: 11 times

Re: How to set return code of whole job to 0 ?

Postby BillyBoyo » Sat Jan 03, 2015 8:56 pm

Here's a link: http://www-03.ibm.com/systems/z/os/zos/library/bkserv/

Looking in the 1.13 JCL Reference, JOBRC is there, which change-bars to show that it is new.

These users thanked the author BillyBoyo for the post:
Terry Heinze (Sat Jan 03, 2015 9:21 pm)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post