Page 1 of 1

JCL override a step in a Proc called by a Proc...

PostPosted: Fri Feb 15, 2013 10:18 pm
by 20sam13
I understand, and do use, the //procstep.ddcard expression override method from the submitting JCL to override a ddcard in the called/executed proc. What i want to know is there a way from the JCL to override ddcard(s) in a 2nd level proc? Or, a proc called by the main proc?

Crude example:
//jobname jobcard
//Step01 EXEC PROC1,
//               SYMBOLIC1,
//               SYMBOLIC2
//STPR0060.TOOLIN DD DSN=TEST.SYSIN(ITOOL001),DISP=SHR
//*  //hopefully with an override dd card right here to the sub-proc of the PROC1
:
//PROC1 proc
//procst01 EXEC SORT
//SORTOUT DD
//*SYSIN DD PROD.SYSIN(SORT001),DISP=SHR
//SYSIN DD TEST.SYSIN(SORT001),DISP=SHR
:
//SORTGWC proc symbolic1,
//                symbolic2,
//                symbolic3
//SORT1 EXEC PGM=SORT
//STEPLIB
//SYSOUT
:
:
:


I would like to override the //SYSIN DD TEST.SYSIN(SORT001),DISP=SHR with a different sort SYSIN card when testing the job on different platforms and the SYSIN is promoted up to each platform.

If it is possible, the hope is to stop hard coding "test platform" changes in the PROC01 for the sort, by doing it from the //jobname JCL member.

Thanks for the help!
-Scott

Re: JCL override a step in a Proc called by a Proc...

PostPosted: Fri Feb 15, 2013 10:22 pm
by Robert Sample
The JCL Reference Manual (link at the top of this page) explicitly tells you (with emphasis added by me):
5.3.2 Modifying Nested Procedures


The rules for modifying OUTPUT JCL and DD statements described in "Modifying OUTPUT JCL and DD Statements" in topic 5.2.1.2 apply to nested procedures.

In addition, the following rules apply to modifying statements in nested procedures.


Procedure and step names referenced by other statements in the job should be unique within the job.

Modifying or additional JCL statements must appear in the job stream following the EXEC statement for the procedure they are to modify and prior to the next EXEC statement.

Modifying or additional JCL statements apply to one level of nesting only. You can use statements to modify statements in a procedure only for the level of nesting at which the EXEC statement for that procedure appears.

Modifying or additional JCL statements cannot themselves be modified. Do not modify statements that are overrides or additions to a procedure.

Modifying or additional JCL statements can only have procstepname.name or procstepname.ddname in their name field. Do not specify backward references to nested procedures, such as procstepname.procstepname.ddname DD parameters.

Re: JCL override a step in a Proc called by a Proc...

PostPosted: Sat Feb 16, 2013 12:29 am
by 20sam13
Robert,

Thanks for the explanation & link. I kept googl'ing for something, but just could not find the correct string to search for (would have never considered Modifying Nested Procedures).

So, the long & the short of it is yes & no....

If it is the 1st proc called that calls the 2nd proc which is what I want to override, it "can" be done from the JCL.

I gather, it would look something like this?

//PROC1 proc
//steppr01 exec sort <=== the next proc
//sort01.sysin dd dsn=prod.sysin(prodsort),disp=shr (sort01 is the actual exec=sort step in the 2nd-level proc)

//JOBNAME jobcard
//step01 exec PROC1
//sort01.sysin dd dsn=test.sysin(testsort),disp=shr

So, hopefully, the JCL will override the PROC1.steppr01.sortgwc.sysin with dsn=test.sysin(testsort),disp=shr ???

Thus, in summary, the 1st proc has to have the 2nd proc's step#.ddcard coded in it, to override from the JCL?

Or... am I just way off in my interpretation of the rules? Honestly, I am a little confused as I have never worked in a shop where 2nd level proc's were called/executed from 1st level proc's. Can you help a little further by using my example I provided?

Thanks!

Re: JCL override a step in a Proc called by a Proc...

PostPosted: Sat Feb 16, 2013 1:16 am
by Robert Sample
If your job invokes PROC1 (which is a PROC) and PROC1 invokes SORT (which is a PROC), basically what the manual is telling you is that you can change PROC1 with overrides and so forth, but SORT will be executed as invoked by PROC1 -- you cannot add, change, or override the SORT procedure statements within your job. This is what the red sentences (in the quote I posted) mean.

Nested procedures are tough to get correct because you lose control over the statements in the nested procedure.

Re: JCL override a step in a Proc called by a Proc...

PostPosted: Sat Feb 16, 2013 1:23 am
by 20sam13
Yikes!

So, if Proc1 has an override to the Sort Proc, then it is possible to code an override in the JCL to the Proc1 call of the Sort Proc, or am I really messed up? I read thru the example I found where they had JCL, which called Proc A, which called Proc B which called Proc C. In Proc B they had an override to a ddcard in Proc C.

So, if I were to eliminate (based upon their example), Proc B, then....

JCL would call Proc A, Proc A would call Proc C with the override from Proc A. Can the JCL which calls Proc A, have an override to Proc A to override what Proc A is trying to change in Proc C?

How is that for confusing parsing and summarizing?

Thanks!