View previous topic :: View next topic
|
Author |
Message |
vinay19
New User
Joined: 31 May 2007 Posts: 24 Location: Bangalore
|
|
|
|
hi,
My JCL executes a single PROC many number of times. The PROC contains a symbolic variable, which would be overridden from JCL.
Can you please let me know if its possible to override the symbolic variable only once, so that the proc executing any step of the JCL contains that value? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Your question is not entirely clear, please elaborate. |
|
Back to top |
|
|
vinay19
New User
Joined: 31 May 2007 Posts: 24 Location: Bangalore
|
|
|
|
Please look at the example below
JCL:
//.....
//STEP1 EXEC PROC=PROC1,PARM1=TEST,PARM2=ABC
//......
//......
//STEP2 EXEC PROC=PROC1,PARM2=TEST,PARM2=DEF
//.....
//.....
As you see from the above example, I am executing the PROC PROC1 twice. The proc requires two parameters to run PARM1, PARM2. Only PARM2 changes for different steps but PARM1 remains the same any time I execute the proc in this JCL. (But it differs across different JCLs).
I want to know if there is way I can specify PARM1 value only at one place so that everytime I invoke the PROC it picks the value for PARM1 from that place. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
That depends on the way that the PROC is constructed. |
|
Back to top |
|
|
vinay19
New User
Joined: 31 May 2007 Posts: 24 Location: Bangalore
|
|
|
|
I am using that variable to create a DDNAME
DD DSN=&PARM1..MYPDS.SECQUA,DISP=SHR |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
It all depends on how the PROC is constructed, what do you have coded on the internal PROC statement |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
huh? internal proc statement? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Yeah, the bit that's inside the PROC. I know it's called the PROC statement, but when I was young it was always referred to as the internal, whilst the external was the actual EXEC card.
Old habits die hard |
|
Back to top |
|
|
vinay19
New User
Joined: 31 May 2007 Posts: 24 Location: Bangalore
|
|
|
|
In the PROC statement i have coded the default values for the variable PARM1. But I want this to be overridden from JCL. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
If you had coded
in the procedure, it would have been so much easier. You could have set the value in a SET statement and that would be it.
By having the default variables on the PROC statement you will need to change every occurrence of the EXEC statement.
Code: |
// SET PARM1='ABC'
//*
//PROC1 EXEC PROCNAME,PARM1=&PARM1.,PARM2=whatever1
//PROC2 EXEC PROCNAME,PARM1=&PARM1.,PARM2=whatever2
//PROC3 EXEC PROCNAME,PARM1=&PARM1.,PARM2=whatever3 |
Or to write the procedure correctly |
|
Back to top |
|
|
mtaylor
Active User
Joined: 20 Feb 2009 Posts: 108 Location: Kansas City
|
|
|
|
Here's how symbolic replacement works;
1. A symbol is replaced by the value in the most recently seen SET statement
2. When a PROC is executed, the symbols defined in the PROC stament become active, the overridden symbols in the EXEC statement are applied which replace symbols from the PROC statement.
3. The PROC is processed and symbols are replaced. SET statements in the PROC may change symbols used in the PROC at this point.
4. If a symbol is in the PROC and isn't defined in the PROC statement, the symbol from the enclosing JOB/PROC is used.
5. This entire process is recursive upto the allowed 15 levels of nested PROCS
6. When a PROC end is reached, the symbols it defines or SET are removed
Actually, I haven't tested #6 for SET symbols in a PROC going back to the values before the PROC was called. |
|
Back to top |
|
|
vinay19
New User
Joined: 31 May 2007 Posts: 24 Location: Bangalore
|
|
|
|
expat and mtaylor,
Thanks a lot for your help. |
|
Back to top |
|
|
|