Created SET symbols
The assembler can create SET symbols during conditional assembly processing from other variable symbols and character strings. A SET symbol thus created has the form &(e), where e represents one or more of these:
- Variable symbols, optionally subscripted
- Strings of alphanumeric characters
- Other created SET symbols
After substitution and concatenation, e must consist of a string of up to 62 alphanumeric characters, the first of which is alphabetic. The assembler considers the preceding ampersand and this string as the name of a SET variable. If this created SET symbol has the same name as an existing SET symbol, they are treated as identical. If this created SET symbol does not have the name of any existing SET symbol, the usual rules for assigning type and scope apply.
You can use created SET symbols wherever ordinary SET symbols are permitted, including declarations. You can also nest created SET symbols in other created SET symbols.
&ABC(1) SETC 'MKT','27','$5'
&(&ABC(&I)QUA&I)
.
&I &ABC(&I) Created SET Symbol Comment
1 MKT &MKTQUA1 Valid
2 27 &27QUA2 Invalid: character after '&' not alphabetic
3 $5 &$5QUA3 Valid
4 &QUA4 Valid
&(SYS_HLASM_DATE) SETC '00000000' Default if not available
AIF ('&SYS_HLASM_DATE' LT '20181231').OLD
The created SET symbol can be thought of as a form of indirect addressing. With nested created SET symbols, you can perform this kind of indirect addressing to any level.
In another sense, created SET symbols offer an associative storage
facility. For example, a symbol table of numeric attributes can be
referred to by an expression of the form &(&SYM)(&I)
to
yield the I
th attribute of the symbol name in &SYM
.
As this example indicates, created SET symbols can be declared and
used as arrays of dimensioned variables.
&X(&I,&J,&K)
might
be addressed as &(X&I.$&J.$&K)
, where &I, &J,
and &K typically have numeric values. Thus, &X(2,3,4)
is
represented by &X2$3$4
. The $
separators
guarantee that &X(2,33,55)
and &X(23,35,5)
are
unique: &X(2,33,55) becomes &X2$33$55
&X(23,35,5) becomes &X23$35$5