When you submit JCL that specifies symbols, the system responds
as if you had coded the equivalent JCL (without symbols) produced
by the following sequence of operations:
- Determine the substitution texts. The system:
- Does not consider apostrophes that enclose symbols as part of
their substitution texts.
- Considers parentheses that enclose symbols as part of their substitution
texts.
- Compresses two-to-one the double apostrophes within symbols.
- Compresses two-to-one the double ampersands in symbols that are
not enclosed in apostrophes.
- Does not compress double ampersands within symbols that are enclosed
in apostrophes.
- Substitute all symbols.
- Resolution of all symbols might determine the processing of subsequent
statements. For example, a JCLLIB or INCLUDE statement might contain
symbols that determine which statements are used in the job.
- Symbols on JCL records are treated as if they were resolved simultaneously.
The following example
shows a procedure that defines
JCL symbols:
//EXAMPLE PROC SYM1='What''''s up, Doc?',SYM2=(DEF),SYM3=&&&&TEMP1,
// SYM4='&&TEMP2',SYM5=&&TEMP3,TEMP3=TEMPNAME,
// SYM6=&TEMP3
//S1 EXEC PGM=WTO,PARM='&SYM1',ACCT=&SYM2
//DD1 DD DSN=&SYM3,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD2 DD DSN=&SYM4,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD3 DD DSN=&SYM5,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD4 DD DSN=&SYM6,UNIT=SYSDA,SPACE=(TRK,(1,1))
// PEND
The PROC statement assigns the following substitution texts to
the
JCL symbols:
SYM1 What''s up, Doc?
SYM2 (DEF)
SYM3 &&TEMP1
SYM4 &&TEMP2
SYM5 &TEMP3
TEMP3 TEMPNAME
SYM6 &TEMP3
The equivalent JCL produced by the substitution, when the procedure
is expanded, is:
//S1 EXEC PGM=WTO,PARM='What''s up, Doc?',ACCT=(DEF)
//DD1 DD DSN=&&TEMP1,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD2 DD DSN=&&TEMP2,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD3 DD DSN=&TEMP3,UNIT=SYSDA,SPACE=(TRK,(1,1))
//DD4 DD DSN=&TEMP3,UNIT=SYSDA,SPACE=(TRK,(1,1))
Note the following in the example:
- SYM1 requires four apostrophes in its original definition because
it is substituted into a parameter enclosed in apostrophes. The system
compresses the apostrophes in the symbol definition when the value
of the symbol is determined, and again when the EXEC PARM parameter
is processed. The parameter passed to the WTO program is:
What's up, Doc?
- The single ampersand produced by SYM5 in the DSN parameter
of DD3 cannot be interpreted as the start of a new JCL
symbol, since substitution
is performed only once for a given statement. All symbols are treated
as if they were resolved simultaneously. If the symbol TEMP3 defined
on the PROC statement is not used elsewhere in the procedure, a JCL
error results.
- The symbol TEMP3 cannot be used to assign a value for the symbol
SYM6 on the same statement. Because all symbolic parameters are resolved
simultaneously, the value assigned to SYM6 cannot depend on another
symbol defined at the same time. The system assigns the value &TEMP3,
not &&TEMP2, to SYM6. Again, if the symbol TEMP3 is not used
elsewhere in the procedure, a JCL error will result.