On 21/06/2018 12:28 PM, Paul Gilmartin wrote:
I believe that symbols assigned values in a PROC statement or in EXEC PRC=
are local to that PROC (and its children?) Symbols assigned values in a SET
statement within a PROC are global. Ugh! It may be better to eschew SET
within a PROC; rather supply default values in the PROC header.
Symbols in a PROC header don't work consistently. SET is required for
predictable behaviour.
//PROC1 PROC VVV=
// EXPORT SYMLIST=VVV
//PSTEP1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN DD DUMMY
//SYSUT1 DD *,SYMBOLS=JCLONLY
SYMBOL VVV=&VVV
/*
//SYSUT2 DD SYSOUT=*
// PEND
//JSTEP1 EXEC PROC1,VVV=VALUE1
//JSTEP2 EXEC PROC1,VVV=VALUE2
gives IEFC657I THE SYMBOL VVV WAS NOT USED for the first step, but not
subsequent steps (occurring after the first proc's EXPORT SYMLIST=VVV).
If symbol VVV is used in the JCL:
//PROC1 PROC VVV=VPWRKA
// EXPORT SYMLIST=VVV
//PSTEP1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN DD DUMMY
//SYSUT1 DD *,SYMBOLS=JCLONLY
SYMBOL VVV=&VVV
/*
//SYSUT2 DD SYSOUT=*
//DD1 DD DISP=(OLD,DELETE),UNIT=SYSDA,VOL=SER=&VVV
// PEND
//JSTEP1 EXEC PROC1,VVV=VPWRKB
//JSTEP2 EXEC PROC1,VVV=VPWRKC
gives output:
SYMBOL VVV=&VVV
SYMBOL VVV=VPWRKC
The in stream symbol is not substituted in the first step but it is
substituted correctly in subsequent steps. The JCL symbol is substituted
as expected.
If you SET VVV=&VVV the symbols are substituted as expected:
//PROC1 PROC VVV=VPWRKA
// EXPORT SYMLIST=VVV
// SET VVV=&VVV
//PSTEP1 EXEC PGM=IEBGENER
//SYSPRINT DD DUMMY
//SYSIN DD DUMMY
//SYSUT1 DD *,SYMBOLS=JCLONLY
SYMBOL VVV=&VVV
/*
//SYSUT2 DD SYSOUT=*
// PEND
//JSTEP1 EXEC PROC1,VVV=VPWRKB
//JSTEP2 EXEC PROC1,VVV=VPWRKC
SYMBOL VVV=VPWRKB
SYMBOL VVV=VPWRKC
Be careful. If the SYSIN appears within a PROC and different symbol values
are in effect at various EXEC PRC=... statements, multiple copies of that
SYSIN might need to be supplied for the various proc steps.
If I have
//DD1 DD DISP=(OLD,DELETE),UNIT=SYSDA,VOL=SER=&VVV
I end up with multiple copies of that JCL statement with different
values. I have no problem with multiple copies of the SYSIN, it is what
I expected.
--
Andrew Rowley
Black Hill Software
+61 413 302 386
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN