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. Subsequently, 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
- This example shows exported symbol resolution when
symbols are used inside procedures:
_// 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