Examples of defining and coding symbols in JCL
Example 1:
//JOBA JOB ...
//INSTREAM PROC LOC=POK
//PSTEP EXEC PGM=WRITER
//DSA DD SYSOUT=A,DEST=&LOC
// PEND
//CALLER EXEC PROC=INSTREAM,LOC=NYC
//In this example of an in-stream procedure, the &LOC symbol has a default value of POK on the PROC statement; then it is assigned an execution value of NYC on the calling EXEC statement.
Example 2:
//JOBB JOB ...
//INSTREAM PROC LOC=POK,NUMBER=3390
//PSTEP EXEC ...
//PIN DD DSNAME=REPORT,DISP=(OLD,KEEP),UNIT=&NUMBER
//POUT DD SYSOUT=A,DEST=&LOC
// PEND
//CALLER EXEC PROC=INSTREAM,NUMBER=,LOC=STL
//PSTEP.INDATA DD *
.
(data)
.
/*This code nullifies the &NUMBER JCL symbol. The calling EXEC statement assignment of STL for the &LOC symbol overrides the PROC statement assignment of POK.
Example 3: This example illustrates execution of
an in-stream procedure to test symbols before placing the procedure
in a procedure library. The in-stream procedure named TESTPROC is:
//TESTPROC PROC A=IMB406,B=ABLE,C=3390,D=WXYZ1,
// E=OLD,F=TRK,G='10,10,1'
//STEP EXEC PGM=&A
//DD1 DD DSNAME=&B,UNIT=&C,VOLUME=SER=&D,DISP=&E,
// SPACE=(&F,(&G))
// PENDTo run this in-stream procedure and override &A with IEFBR14, &B with BAKER, and &E
with (NEW, KEEP) but leave the other parameters the same, call the in-stream procedure with:
//CALLER1 EXEC PROC=TESTPROC,A=IEFBR14,B=BAKER,E=(NEW,KEEP)The value (NEW,KEEP) does not require apostrophes because it contains a matched pair of parentheses. For more information, see Table 3.
After symbolic substitution, the statements are:
//STEP EXEC PGM=IEFBR14
//DD1 DD DSNAME=BAKER,UNIT=3390,VOLUME=SER=WXYZ1,
// DISP=(NEW,KEEP),SPACE=(TRK,(10,10,1))Example 4: To run the in-stream procedure in the previous example and change DD1 to
resemble a temporary scratch space, code the following statement:
//CALLER2 EXEC PROC=TESTPROC,A=IEFBR14,B=,C=3390,D=,E=After symbolic substitution, the statements are:
//STEP EXEC PGM=IEFBR14
//DD1 DD DSNAME=,UNIT=3390,VOLUME=SER=,DISP=,SPACE=(TRK,(10,10,1))Example: 5 Symbol values can be set to values previously set to other
symbols.
// SET SYM1=VALUE1
// SET SYM2=&SYM1
// SET TARGET=&SYM2
//STEP1 EXEC PGM=WTO,PARM=&TARGET In this example, the value of TARGET resolves
to a value of VALUE1.Example 6: In this example, blanks are maintained in symbol values
that are coded with apostrophes. This example illustrates where exported symbols SYM1 and SYM2
contain blanks:
// EXPORT SYMLIST=(*)
// SET SYM1='A '
// SET SYM2='1234 '
// SET SYM3='WXYZ'
//STEP2 EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *,SYMBOLS=JCLONLY
SYMBOL VALUES=&SYM1&SYM2&SYM3
/*
//SYSUT2 DD SYSOUT=* In this example, the resolved symbols that are displayed in
SYSUT2 are:SYMBOL VALUES=A 1234 WXYZ