Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Executing a PROC multiple times in a JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Executing a PROC multiple times in a JCL
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: 8619
Location: Back in jolly old England

PostPosted: Wed May 19, 2010 3:51 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Wed May 19, 2010 3:54 pm    Post subject: Re: Executing a PROC multiple times in a JCL
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: 6970
Location: porcelain throne

PostPosted: Wed May 19, 2010 3:57 pm    Post subject:
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: 8619
Location: Back in jolly old England

PostPosted: Wed May 19, 2010 4:55 pm    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Wed May 19, 2010 4:59 pm    Post subject:
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    Post subject:
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: 6970
Location: porcelain throne

PostPosted: Wed May 19, 2010 5:03 pm    Post subject:
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    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 Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm
No new posts Updating multiple counts in trailer!! Vignesh Sid SYNCSORT 4 Mon Nov 06, 2017 1:04 pm
No new posts Selecting a row from multiple tables! Vignesh Sid DB2 2 Thu Oct 26, 2017 6:09 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us