View previous topic :: View next topic
|
Author |
Message |
andycool
New User
Joined: 12 Apr 2005 Posts: 64
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hi Andy......
Will you tell us........What are you coding in STEP2......
Regards,
Priyesh. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
kcprem
New User
Joined: 30 Jun 2005 Posts: 18
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
kcprem
New User
Joined: 30 Jun 2005 Posts: 18
|
|
|
|
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 |
|
|
andycool
New User
Joined: 12 Apr 2005 Posts: 64
|
|
|
|
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 |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
andycool
New User
Joined: 12 Apr 2005 Posts: 64
|
|
|
|
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 |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
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 |
|
|
|