IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Executing a PROC multiple times in a JCL


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

New User


Joined: 31 May 2007
Posts: 24
Location: Bangalore

PostPosted: Wed May 19, 2010 3:22 pm
Reply with quote

Hello,

I have a cataloged procedure whose skeleton is as mentioned below.

//TESTPROC PROC
//PSTEPA EXEC SAS
-----------------------
-----------------------
// IF PSTEPA.SAS.RC = 0 THEN
//PSTEPB ....
//PSTEPC ....

As you can see I am validating return code of the sas program executed in PSTEPA.
Now I execute this proc from my JCL. This setup works perfectly fine for me if am invoking the above proc only once from my JCL.
e.g JCL1:
//STEP1 EXEC TESTPROC,PARM=1

Whereas I have a problem if I am invoking the proc multiple times, starting from second time onwards.

When I scan my JCL (JCL2), it says "STATEMENT NAMED "PSTEPA " IS A DUPLICATE"
e.g JCL2:
//STEP1 EXEC TESTPROC,PARM=1
//STEP2 EXEC TESTPROC,PARM=2

Also return code PSTEPA.SAS.RC will be retained to what value it gets set when the proc executes for first time.

I need to execute the proc multiple times for different parameters. Although I have found a work around, I wanted to know the reason for this behavior.

Thanks
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 19, 2010 3:51 pm
Reply with quote

vinay19 wrote:
Also return code PSTEPA.SAS.RC will be retained to what value it gets set when the proc executes for first time.

I vaguely recall that is correct. As for the reason - you will need to ask IBM for that one.
Back to top
View user's profile Send private message
superk

Global Moderator


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

PostPosted: Wed May 19, 2010 3:54 pm
Reply with quote

I think it's been stated enough times here how it's never a good idea to use nested procs, so I won't comment on that.

As far as ...

vinay19 wrote:
Also return code PSTEPA.SAS.RC will be retained to what value it gets set when the proc executes for first time.


I'm going to have to see if that is a true statement since it doesn't make logical sense to me why it would act that way.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 3:57 pm
Reply with quote

when one uses cond codes
- as apposed to IF/THEN - which is so flexible
you don't have the problem.......
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 19, 2010 4:55 pm
Reply with quote

Of course, if the person who used the IF statement in the proc had coded the JCL correctly, there would never be a problem, no matter how many nested levels are used.

Something I found out the fun way by trying to correct the errors of another, and always code my procs properly if I use IF/THEN/ELSE/ENDIF statements icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 4:59 pm
Reply with quote

this is not a nested proc problem!

this is the same proc invoked repeatedly by the job,
something that is done often,
such as compiling many modules, with a parm for module name for each invocation of the proc.

as expat says, if the rookie had coded the IF/THEN properly, there would be no problem.
Back to top
View user's profile Send private message
vinay19

New User


Joined: 31 May 2007
Posts: 24
Location: Bangalore

PostPosted: Wed May 19, 2010 5:00 pm
Reply with quote

Same is the problem with use of COND CODES.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed May 19, 2010 5:03 pm
Reply with quote

Vinay wrote:
Same is the problem with use of COND CODES.


dbz wrote:
as expat says, if the rookie had coded the IF/THEN properly, there would be no problem


same applies.....
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

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top