Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to set return code of a step to zero ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Thu Jul 07, 2005 1:48 pm    Post subject: How to set return code of a step to zero ?
Reply with quote

Hi Guys,
Here is my query, ll try to elaborate to the max details:

Requirenment:
Need to set the returncode of a particular step in a job to zero no matter wht return code it gives.

Example:
======consider=======
JOB1
step1
cond=(0,LE)
step2
cond=(0,LE)
step3
cond=(0,LE)
step8
cond=(0,LE)
END
==================

Now, if step2 gives any returncode except zero, i need to set it to zero and proceed with the next step. Some'g like below:

=======to be========
JOB1
step1
cond=(0,LE)
step2
if rc(step2) not equal to zero
set rc(step2) = 0
step3
cond=(0,LE)
step8
cond=(0,LE)
END
==================

Please let me know if its possible to do so. It would be more handy if you can put in the piece of code required for this here.

[Note: I dont want to use the EVEN cond parameter as it will remove the dependancies of the steps.]

Thanks in Advance!
Regards,
Andycool
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Thu Jul 07, 2005 3:20 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

Hi Andy......

Will you tell us........What are you coding in STEP2......

Regards,

Priyesh.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jul 07, 2005 6:21 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

The program that is being executed in a step is the ONLY entity that can control the value of the return-code for that step. Nothing else can influence the value contained in the return-code register for that step.
Back to top
View user's profile Send private message
kcprem

New User


Joined: 30 Jun 2005
Posts: 18

PostPosted: Thu Jul 07, 2005 8:05 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

Hi,

The below code will over write the return code of the step.

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTC ENT ('DSNAME') /* or any commands/code */
IF MAXCC LE 8 THEN DO
SET MAXCC = 0
END

Hope this will help.

Thanks,
Prem
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jul 07, 2005 8:40 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

kcprem wrote:
Hi,

The below code will over write the return code of the step.

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTC ENT ('DSNAME') /* or any commands/code */
IF MAXCC LE 8 THEN DO
SET MAXCC = 0
END

Hope this will help.

Thanks,
Prem

How would this work any differently than this:

//STEP01 EXEC PGM=IEFBR14
Back to top
View user's profile Send private message
kcprem

New User


Joined: 30 Jun 2005
Posts: 18

PostPosted: Thu Jul 07, 2005 9:19 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

Hi SuperK,

As of now I don't know the answer. Let me check and if i got answer will let you know.
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Fri Jul 08, 2005 12:13 pm    Post subject:
Reply with quote

Hi Guys,
Frist of all thanks for your inputs. They have been very helpful.

1. The program at step two is some user defined program and not any IDCAMS or ICEGENER or IEFBR14.

2. Due to some reasons this program is delibaretely abended with the user abends.

3. I dont want to touch this pgm or make any code changes to it.

4. Hence, my query was specifically handling the returncode of this step in a JCL.

5. From the piece of code provided above with the IDCAMS i guess i need to handle it as below. Please correct me if i am wrong:


=======to be========
JOB1

//step1 exec pgm=prog1
// cond=(0,LE)
//step2 exec pgm=prog2 //problem area
// cond=(0,LE)
//STEP3 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTC ENT ('??????') /* Not clear wht shud i enter here */
IF MAXCC NE 0 THEN DO /* Anything other than 0 shud be 0 */
SET MAXCC = 0
END
//step4 exec pgm=prog4
// cond=(0,LE)
//step8 exec pgm=prog5
// cond=(0,LE)

END
==================

Please tell me wether what i understood and illustrated above from your comments is correct. If not please guide me.

Thanks in Advance,

Regards,
--andyccol
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Jul 08, 2005 3:46 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

Hi ANdy,

The code you mentioned is going to set MAXCC of STEP3 0....means after execution of step3, you will get a RC=0.....

I think It has not to do any thing with STEP2.....And it wont affect RC from STEP2...
as superk already said above.....RC for any step can be changed within that step only....not after complete execution......

Correct me If I m not....

Regards,

Priyesh.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jul 08, 2005 4:04 pm    Post subject: Re: How to set return code of a step to zero ?
Reply with quote

Personally, I would take the execution of prog2 out of the job and "wrap" a TSO session around it (execute PGM=IKJEFT01 instead) so that I could trap the program's return-code and take the appropriate action, or to just force a step completion code of zero on the IKJEFT01 program.
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Fri Jul 08, 2005 9:24 pm    Post subject:
Reply with quote

Correct me if I'm wrong but one way to reset the rc can be rexx!? I mean: if I call my COBOL program with a REXX code and i get its return code I will be able to reset it. I'm correct?
Back to top
View user's profile Send private message
andycool

New User


Joined: 12 Apr 2005
Posts: 64

PostPosted: Sat Jul 09, 2005 1:16 pm    Post subject:
Reply with quote

Hi Guys,
Thanks for your inputs SuperK, MGIndalco and Priyesh. There was some problem with my machin so couldnot reply back fast.
However, I have just a small doubt with this code mentioned by SuperK

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTC ENT ('DSNAME') /* or any commands/code */
IF MAXCC LE 8 THEN DO
SET MAXCC = 0
END

======
Doubts:||
======

1. Is it mandatory to use the program IDCAMS for using this code:
LISTC ENT ('?????')
IF MAXCC LE 8 THEN DO
SET MAXCC = 0
END

2. Cant the above code be used like this:
//step2 exec pgm=prog2 /*prog2 is some user defined program*/
// cond=(0,LE)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTC ENT ('??????') /* Not clear wht shud i enter here */
IF MAXCC NE 0 THEN DO /* Anything other than 0 shud be 0 */
SET MAXCC = 0
END

3. Will this solve my purpose? Please correct me if i am missing something.

Thanks and Regards,
--Andycool
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Sat Jul 09, 2005 1:31 pm    Post subject:
Reply with quote

The command SET MAXCC = x is used to override internal return code of IDCAMS.
Really there are two Retrun code in IDCAMS that are LASTCC and MAXCC, but this function work only within IDCAM. I'm sure that I'm not clear and so I will give you an example:
Suppose that you want to copy a dataset and, if copy is done, you want to delete the input dataset:

Code:
//STEP010R EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INP1     DD DSN=....
//OUT1     DD DSN=....
//SYSIN    DD *
  REPRO INFILE(INP1) OUTFILE(OUT1)
  IF LASTCC = 0 THEN DO
     DELETE (dsninp1)
  END
  ELSE DO
     SET MAXCC = 3
  END


With this you can set the RC of this step as you want but it work like a piece of program as Superk said.

I think that if you don't want to change your pgm you have few chance:
1) divide your steps in two jcl
2) try(but you must to know how many dd can you allocate with your profile) to use a rexx code to call your program and then set the EXIT RC as you need.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts MAX-RC 88 and Return code 606 in DFH0... lind sh CICS 2 Tue Jan 24, 2017 1:23 pm
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 2 Thu Jan 12, 2017 12:02 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us