Examples
- In this example, the symbol parameters COUNTY, TOWN, and STATE
are set by the SET statement. The EXPORT statement indicates that
the symbolic parameters COUNTY and STATE are to be made available
to the MYPROG program that is executed in STEP1:
//MYEXP EXPORT SYMLIST=(COUNTY,STATE) //STEP1 SET COUNTY=DUTCHESS,TOWN=FISHKILL,STATE=NY //STEP1 EXEC PGM=MYPROG
- Exported symbolic parameters are resolved to the most recent value to which they are set. In the
following example, MYPROG1 in STEP1 receives an exported value of SYMVAL1 for SYM1. Then, the
program MYPROG1 in STEP2 receives an exported value of NEWSYMVAL for SYM1. In STEP3, the exported
value for SYM3 is null because its value was not set before MYPROG1 executing in STEP3. In STEP4 and
STEP5, MYPROG1 receives the exported value of SYMVAL3 for SYM3.
The value of SYMVAL2, for symbol SYM2, is made available to all of the job steps following the export statement labeled MYEXPR1. The value of SYMVAL1, for symbol SYM1, is made available to STEP1. The updated value of NEWSYMVAL, for symbol SYM1, is made available to STEP2 and the remaining job steps:
//MYEXPR1 EXPORT SYMLIST=(SYM1,SYM2) // SET SYM1=SYMVAL1,SYM2=SYMVAL2 //STEP1 EXEC PGM=MYPROG1 //STEP2 EXEC PGM=MYPROG1 // SET SYM1=NEWSYMVAL //MYEXPR2 EXPORT SYMLIST=SYM3 //STEP3 EXEC PGM=MYPROG1 //STEP4 EXEC PGM=MYPROG1 // SET SYM3=SYMVAL3 //STEP5 EXEC PGM=MYPROG1
- Examples 3a. and 3b. execute a procedure that contains the following JCL:
//PROC1 PROC //PSTEP1 EXEC PGM=IEBGENER //SYSUT1 DD *,SYMBOLS=(JCLONLY) PSTEP1 SYM1 VALUE = &SYM1 //SYSUT2 DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //PSTEP2 EXEC PGM=IEBGENER //SYSUT1 DD *,SYMBOLS=(JCLONLY) PSTEP2 SYM1 VALUE = &SYM1 //SYSUT2 DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //PSTEP3 EXEC PGM=IEBGENER //SYSUT1 DD *,SYMBOLS=(JCLONLY) PSTEP3 SYM1 VALUE = &SYM1 //SYSUT2 DD SYSOUT=* //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //PROC1 PEND
- This example illustrates how an exported symbol value is resolved when the SET statement resides
immediately following EXEC PROC
statements.
Considering the expanded JCL shown in the job log, the//JOB ... // EXPORT SYMLIST=* // SET SYM1=ONE //JSTEP1 EXEC PROC1 // SET SYM1=TWO //JSTEP2 EXEC PROC1 //JSTEP3 EXEC PROC1 // SET SYM1=THREE
statement resides in the job step scope of JSTEP1.PSTEP3. Therefore, the exported symbol value of SYM1 is TWO beginning at step JSTEP1.PSTEP3.//SYM1 EXPORT EXPSET=TWO
is seen in the job log in the job step scope of JSTEP3.PSTEP3. Therefore, the exported symbol value of SYM1 changes to THREE at step JSTEP3.PSTEP3. SYM1 resolves to the following values://SYM1 EXPORT EXPSET=THREE
Job Step Proc Step SYSUT1 results in -------- ---- ----------------- JSTEP1 PSTEP1 PSTEP1 SYM1 VALUE = ONE JSTEP1 PSTEP2 PSTEP2 SYM1 VALUE = ONE JSTEP1 PSTEP3 PSTEP3 SYM1 VALUE = TWO JSTEP2 PSTEP1 PSTEP1 SYM1 VALUE = TWO JSTEP2 PSTEP2 PSTEP2 SYM1 VALUE = TWO JSTEP2 PSTEP3 PSTEP3 SYM1 VALUE = TWO JSTEP3 PSTEP1 PSTEP3 SYM1 VALUE = TWO JSTEP3 PSTEP2 PSTEP3 SYM1 VALUE = TWO JSTEP3 PSTEP3 PSTEP3 SYM1 VALUE = THREE
- This example illustrates how a job step following an EXEC PROC1 statement affects how exported
symbol values are
resolved.
Considering the expanded JCL shown in the job log, the//JOB ... // EXPORT SYMLIST=* // SET SYM1=ONE //JSTEP1 EXEC PROC1 //NULLSTP1 EXEC PGM=IEFBR14 // SET SYM1=TWO //JSTEP2 EXEC PROC1 //NULLSTP2 EXEC PGM=IEFBR14 // SET SYM1=THREE //JSTEP3 EXEC PROC1
statement resides in the job step scope of NULLSTP1. Therefore, the exported symbol value of SYM1 is TWO beginning at NULLSTP1.//SYM1 EXPORT EXPSET=TWO
is seen in the job log in the job step scope of NULLSTP2. Therefore, the exported symbol value of SYM1 changes to THREE beginning at step NULLSTP2. The exported symbol value of SYM1 resolves to the following values://SYM1 EXPORT EXPSET=THREE
Job Step Proc Step SYSUT2 results in -------- ---- ------------------ JSTEP1 PSTEP1 PSTEP1 SYM1 VALUE = ONE JSTEP1 PSTEP2 PSTEP2 SYM1 VALUE = ONE JSTEP1 PSTEP3 PSTEP3 SYM1 VALUE = ONE JSTEP2 PSTEP1 PSTEP1 SYM1 VALUE = TWO JSTEP2 PSTEP2 PSTEP2 SYM1 VALUE = TWO JSTEP2 PSTEP3 PSTEP3 SYM1 VALUE = TWO JSTEP3 PSTEP1 PSTEP1 SYM1 VALUE = THREE JSTEP3 PSTEP2 PSTEP2 SYM1 VALUE = THREE JSTEP3 PSTEP3 PSTEP3 SYM1 VALUE = THREE
- This example illustrates how an exported symbol value is resolved when the SET statement resides
immediately following EXEC PROC
statements.
- Exported symbol values that are passed in on PROC statements are resolved in
the scope of the job step in which they are used. Symbols that are passed to nested procedures are
resolved at the procedure level that is current to where the exported symbol value is used. The job
log of the following example
contains
statements. Their placement in the JCL shows the scope at which the exported symbol values are set and received by the executing program for each step in the job.//WHO EXPORT EXPSET=xxx and //WHAT EXPORT EXPSET=yyy
// EXPORT SYMLIST=* //PROC2 PROC WHAT=SPOCK // SET WHO=LEONARD //P2STEP1 EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=* //SYSUT1 DD *,SYMBOLS=(JCLONLY) WHO = &WHO WHAT = &WHAT //PROC2 PEND //PROC1 PROC //P1STEP1 EXEC PGM=IEBGENER //SYSIN DD DUMMY //SYSPRINT DD SYSOUT=* //SYSUT2 DD SYSOUT=* //SYSUT1 DD *,SYMBOLS=(JCLONLY) WHO = &WHO //P1STEP2 EXEC PROC2,WHAT=ROCK // SET WHAT=SCISSORS // SET WHO=SHELDON //PROC1 PEND // SET WHO=HOWARD //JSTEP1 EXEC PROC1 // SET WHO=PENNY // SET WHAT=PAPER //JSTEP2 EXEC PROC1 //JSTEP3 EXEC PROC1 // SET WHO=AMY //JSTEP4 EXEC PROC2,WHAT=LIZARD //JSTEP5 EXEC PROC2
Exported symbolics for this job resolve for each step as follows:Step Name Proc Step WHO WHAT --------- --------- --- ---- JSTEP1 P1STEP1 HOWARD P1STEP2 P2STEP1 PENNY PAPER JSTEP2 P1STEP1 PENNY P1STEP2 P2STEP1 SHELDON SCISSORS JSTEP3 P1STEP1 PENNY P1STEP2 P2STEP1 AMY SCISSORS JSTEP4 P2STEP1 LEONARD LIZARD JSTEP5 P2STEP1 LEONARD SPOCK
- 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:
In this example, the resolved symbols that are displayed in SYSUT2 are:// 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=*
SYMBOL VALUES=A 1234 WXYZ