IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

Not able to set Return code to Zero


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vickey_dw

New User


Joined: 10 Jun 2015
Posts: 51
Location: India

PostPosted: Fri Aug 07, 2015 11:23 am
Reply with quote

Hello All

In one of my step i am checking if the file is empty or not using ICETOOL

Now i want to execute an email step if the file is not empty and if the file is empty i want to complete the job successfully.

i am using below

Code:
// IF  STEP#02.RC  < 5 THEN
//send email step
// ENDIF
//*
// IF  STEP#02.RC  = 12 THEN
//STEP#04  EXEC PGM=IDCAMS
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
 SET MAXCC = 00
//

When file is not empty its working fine and sending email.

But when my file is empty job throwing return code 12 not 00.
I want it to complete it with return code 00 if file is empty.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 865
Location: The Universe

PostPosted: Fri Aug 07, 2015 11:44 am
Reply with quote

Here is where it is important to know your release. Prior to z/OS 1.13, a job return code was the highest step return code in the job. In z/OS 1.13 you could use the JOB statement JOBRC parameter to influence the setting. The default is JOBRC=MAX - the old behavior. There are other options, best discovered in the JCL Reference manual for your release.
Back to top
View user's profile Send private message
vickey_dw

New User


Joined: 10 Jun 2015
Posts: 51
Location: India

PostPosted: Fri Aug 07, 2015 12:36 pm
Reply with quote

Thanks Steve for your input !!!

I am now able to set return code to 00 using JOBRC.

But is there any other way to achieve this because i am not sure how this will behave in production.Also in our shop we don't move JCL to production with Job-card (its added by production control team) and JOBRC needs to be specified in Job-card.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Fri Aug 07, 2015 1:33 pm
Reply with quote

You'll have to talk to your Production Control and ask them how to do what you want (or think you want) to do.

IDCAMS can only set the RC/CC for the step which executes the IDCAMS.

If you can explain why you are getting non-zero values, and why you want to pretend they are zero, then there may be ideas.

Probably the simplest is to split your JOB into multiple JOBs, the last of which can only give zero (even if that is done using IEFBR14). That would allow you to control unexpected RC/CC values, and also produce zero for your expected non-zero values.
Back to top
View user's profile Send private message
vickey_dw

New User


Joined: 10 Jun 2015
Posts: 51
Location: India

PostPosted: Fri Aug 07, 2015 1:59 pm
Reply with quote

Quote:
If you can explain why you are getting non-zero values, and why you want to pretend they are zero, then there may be ideas.


Hi Bill

I am getting non-zero value because of the step which checks file is empty or
not.If file is not empty then i want to execute the email step else just compete the job successfully.
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 865
Location: The Universe

PostPosted: Fri Aug 07, 2015 5:10 pm
Reply with quote

vickey_dw wrote:
... I am getting non-zero value because of the step which checks file is empty or
not.If file is not empty then i want to execute the email step else just compete the job successfully.
This is why you have the JCL IF / THEN / ENDIF statements or the EXEC statement COND parameter. As with JOBRC, you can discover them in the JCL Reference manual. Many people find COND= pretty hard to understand despite the fact it's going to celebrate its golden anniversary in a year or two.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Fri Aug 07, 2015 7:57 pm
Reply with quote

Quote:
I am getting non-zero value because of the step which checks file is empty or
not.If file is not empty then i want to execute the email step else just compete the job successfully.


If you are using ICETOOL to check if the file is empty, then you can always set the return code to 4 (instead of 8 or 12).

Then in the next step you need to check if ICETOOL returned 4 (meaning empty) don't run the mail step. If ICETOOL returned 0 then run the mail step.

Code:
COUNT FROM(IN) EMPTY RC4


Will that work?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts JCL for replacing code in Cobol JCL & VSAM 8
No new posts Easytrieve EZABX007 with error code 0... CA Products 7
This topic is locked: you cannot edit posts or make replies. VSAM I/O - Extended Addressability - ... JCL & VSAM 12
No new posts Force a Return Code and print error m... SYNCSORT 30
No new posts trying to set return code in PROC JCL & VSAM 15

Back to Top