Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 8593
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: 4648
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: 6966
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: 8593
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: 6966
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: 6966
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm
No new posts Easytrieve - Report writing - Only 1 ... Abhi Nature CA Products 2 Wed Sep 14, 2016 11:40 am
No new posts How to calculate an specific transact... lind sh CICS 2 Tue Sep 13, 2016 9:20 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us