View previous topic :: View next topic |
Author |
Message |
naveen_summary Beginner
Joined: 12 Feb 2007 Posts: 26 Topics: 13
|
Posted: Fri Jul 04, 2008 8:39 am Post subject: Check for return code of Proc step in Job |
|
|
Hello all,
I have a proc with 2 steps. I need to check the return codes of both the steps in the calling job and based on this execute the next step in job.
I tried giving the stepname.rc but it gives an error of:
STATEMENT REFERENCED BY BACK REFERENCE "step1" CANNOT BE
FOUND. (USED IN "STEPNAME" PARAMETER OF "RC")
STATEMENT REFERENCED BY BACK REFERENCE "step2" CANNOT BE
FOUND. (USED IN "STEPNAME" PARAMETER OF "RC")
Could you please help me out?
Alternate solution would be to check the rc's in proc and then set a new RC which can be used in job using IDCAMS or so..
In PROC:
If (step1.rc=4 and step2.rc=4) then
//SETMAXRC EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SET MAXCC=49
/*
endif
In JOB:
If RC=49 then
Execute next step
Endif |
|
Back to top |
|
 |
Terry_Heinze Supermod
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
|
Posted: Fri Jul 04, 2008 8:56 am Post subject: |
|
|
PROCs do not return RCs -- only steps within PROCs (EXEC PGM=XXX) can do that. Since you don't display your PROC which contains step1 and step2, I can only guess that is the problem. _________________ ....Terry |
|
Back to top |
|
 |
naveen_summary Beginner
Joined: 12 Feb 2007 Posts: 26 Topics: 13
|
Posted: Fri Jul 04, 2008 9:05 am Post subject: |
|
|
This is my code:
Job:
Quote: |
//Proclib dd dsn=x.x.proclib,disp=shr
//jobstep1 Exec proc1
// if (procstep1.rc=4 and procstep2.rc=4) then
//jobstep2 exec pgm=
// endif
|
Proc1
Quote: |
//procstep1 exec pgm=xx
//*
//procstep2 exec pgm=yy
//*
|
On the step
Quote: |
// if (procstep1.rc=4 and procstep2.rc=4) then
|
i get the error as:
STATEMENT REFERENCED BY BACK REFERENCE "step1" CANNOT BE
FOUND. (USED IN "STEPNAME" PARAMETER OF "RC")
STATEMENT REFERENCED BY BACK REFERENCE "step2" CANNOT BE
FOUND. (USED IN "STEPNAME" PARAMETER OF "RC") |
|
Back to top |
|
 |
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Jul 04, 2008 11:29 am Post subject: |
|
|
I do not think you can refer to a nested code iike that - only steps at the current level. You have no procstep1 or 2 at the level that you are doing the check. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
 |
naveen_summary Beginner
Joined: 12 Feb 2007 Posts: 26 Topics: 13
|
Posted: Fri Jul 04, 2008 11:46 am Post subject: |
|
|
Thanks Terry. So, I think I will go for this in the proc:
In PROC:
Quote: |
If (step1.rc=4 and step2.rc=4) then
//procstep2 exec pgm=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SET MAXCC=49
/*
endif
|
In Job:
Quote: |
//Proclib dd dsn=x.x.proclib,disp=shr
//jobstep1 Exec proc1
// if (procstep1.rc=49) then
//jobstep2 exec pgm=
// endif
|
|
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Fri Jul 04, 2008 4:24 pm Post subject: |
|
|
What would be wrong with:
Code: |
//JOBSTEP1 EXEC PROC1
// IF (JOBSTEP1.PROCSTEP1.RC=4 AND JOBSTEP1.PROCSTEP2.RC=4) THEN
//JOBSTEP2 EXEC PGM=
// ENDIF
|
|
|
Back to top |
|
 |
naveen_summary Beginner
Joined: 12 Feb 2007 Posts: 26 Topics: 13
|
Posted: Sun Jul 06, 2008 7:05 am Post subject: |
|
|
I am sure I tried this and it gave me an error. But I will try this tomorrow. |
|
Back to top |
|
 |
naveen_summary Beginner
Joined: 12 Feb 2007 Posts: 26 Topics: 13
|
Posted: Mon Jul 07, 2008 4:08 am Post subject: |
|
|
Superk, I made some mistake last friday.
I tested as you suggested and it works fine. Thanks a lot. |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Mon Jul 07, 2008 7:47 am Post subject: |
|
|
naveen_summary wrote: | I tested as you suggested and it works fine. |
It should. That was straight out of the manual. |
|
Back to top |
|
 |
|
|