Just as the beginning of a symbolic parameter is marked by an ampersand (&). It may be terminated by
a space or a period. When terminated by a period, the period is not part of the name (just as the opening
ampersand isn't).
When an entire string is replaced by a symbolic parameter it is just coded as is:
// SET MYPROG=FRED
//RUNIT EXEC PGM=&MYPROG
Here &MYPROG
is replaced with its value, FRED
. No problem figuring out where the symbolic name started or ended.
Now suppose you wanted to run 3 programs: FRED1
, FRED2
and FRED3
. You could do something like:
//RUN3 EXEC PGM=&MYPROG.3
Here, program FRED3
is being run. The symbol MYPROG
terminated by a period and equates to FRED
, to this the
rest of the text is added yielding FRED3
.
Same thing applies when using symbolic parameters within dataset names. The first period is needed to terminate
the symbol name, the next period is part of the dataset name itself. For example, if symbol USER
evaluates to
ABC123
, then
//MYDSN DD DSN=&USER..MYDATA
evaluates to ABC123.MYDATA
as a data set name. Similarly,
//MYDSN DD DSN=&USER.X.MYDATA
evaluates to: ABC123X.MYDATA
Note that the resulting DSN has a single period, because the first one
terminated the symbolic name and is not part of the result.