MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Check for return code of Proc step in Job

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
naveen_summary
Beginner


Joined: 12 Feb 2007
Posts: 26
Topics: 13

PostPosted: Fri Jul 04, 2008 8:39 am    Post subject: Check for return code of Proc step in Job Reply with quote

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
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Fri Jul 04, 2008 8:56 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
naveen_summary
Beginner


Joined: 12 Feb 2007
Posts: 26
Topics: 13

PostPosted: Fri Jul 04, 2008 9:05 am    Post subject: Reply with quote

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
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri Jul 04, 2008 11:29 am    Post subject: Reply with quote

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
View user's profile Send private message
naveen_summary
Beginner


Joined: 12 Feb 2007
Posts: 26
Topics: 13

PostPosted: Fri Jul 04, 2008 11:46 am    Post subject: Reply with quote

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
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Fri Jul 04, 2008 4:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
naveen_summary
Beginner


Joined: 12 Feb 2007
Posts: 26
Topics: 13

PostPosted: Sun Jul 06, 2008 7:05 am    Post subject: Reply with quote

I am sure I tried this and it gave me an error. But I will try this tomorrow.
Back to top
View user's profile Send private message
naveen_summary
Beginner


Joined: 12 Feb 2007
Posts: 26
Topics: 13

PostPosted: Mon Jul 07, 2008 4:08 am    Post subject: Reply with quote

Superk, I made some mistake last friday.
I tested as you suggested and it works fine. Thanks a lot.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Mon Jul 07, 2008 7:47 am    Post subject: Reply with quote

naveen_summary wrote:
I tested as you suggested and it works fine.


It should. That was straight out of the manual.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group