The general rules described in
Using system symbols and JCL symbols also apply to symbols in nested procedures, along with the following
rules:
- Within a nested procedure, assign only one substitution text per
symbol. You can use the same symbol in other nested procedures and
assign it different values.
- If you assign or nullify the value for a symbol on an EXEC statement
that calls a nested procedure, the substitution text that you specify
on the EXEC statement is used in the procedure. The EXEC statement
overrides any default value you specify on the PROC statement of the
nested procedure.
- When the EXEC statement that calls the nested procedure does not
assign a substitution text to the symbol, the system uses the default
substitution text specified on a PROC statement.
One way to provide
an override value for a symbolic in a nested procedure is to design
the procedure so that it requires no assignment of default symbolic
parameter values. If the PROC statement of the inner procedure contains
no default value, the system uses the value specified on the EXEC
statement of the outer procedure. For example:
//TESTJCL PROC
//STEP1 EXEC TESTJCL1
// PEND
//TESTJCL1 PROC
//STEP2 EXEC PGM=IEFBR14,PARM=&PVAL
//SYSUDUMP DD SYSOUT=A
// PEND
//RUNIT EXEC TESTJCL,PVAL=EXEC0
- If you assign or nullify a substitution text for a symbol on a
SET statement, the substitution text that you specify on the SET statement
is used in all subsequent statements, procedures, and nested procedures.
However, if the calling EXEC statement or the PROC statement of the
procedure assigns or nullifies the symbol, it only applies to subsequent
statements within that PROC and subsequent nested procedures within
that procedure.
- If you do not assign or nullify a value for a JCL
symbol in a nested
procedure, the value used for the JCL
symbol in this
procedure is obtained from the procedure in which this procedure is
nested.
- If a JCL
symbol is not assigned a substitution text or is not nullified, it is an
undefined JCL
symbol which might cause errors in the JCL.
Table 1 shows rules 2 through 6 in
a summary table, which is the order in which the value for a symbol
is resolved.
Table 1. Summary
of Rules 2 through 6 for Symbols in Nested ProceduresValue Used
|
Where the symbol is defined |
---|
EXEC
(Rule 2)
|
PROC
Not EXEC
(Rule 3)
|
SET
Not PROC
Not EXEC
(Rule 4)
|
Nested Value
Not SET
Not PROC
Not EXEC
(Rule 5)
|
None
(Rule 6)
|
---|
EXEC Value
|
X
|
|
|
|
|
PROC Value
|
|
X
|
|
|
|
SET Value
|
|
|
X
|
|
|
Nested Value
|
|
|
|
X
|
|
Undefined
|
|
|
|
|
X
|