The character value assigned to a SETC symbol is substituted for
the SETC symbol when it is used in the name, operation, or operand
field of a statement.
For example, consider the following macro definition, macro instruction,
and generated statements:
MACRO
&NAME MOVE &TO,&FROM
LCLC &PREFIX
&PREFIX SETC 'FIELD' Statement 1
&NAME ST 2,SAVEAREA
L 2,&PREFIX&FROM Statement 2
ST 2,&PREFIX&TO Statement 3
L 2,SAVEAREA
MEND
-------------------------------------------------------------------
HERE MOVE A,B
-------------------------------------------------------------------
+HERE ST 2,SAVEAREA
+ L 2,FIELDB
+ ST 2,FIELDA
+ L 2,SAVEAREA
Statement 1 assigns the character value FIELD to
the SETC symbol &PREFIX. In statements 2 and
3, &PREFIX is replaced by FIELD.
The following example shows how the value assigned to a SETC symbol
can be changed in a macro definition.
MACRO
&NAME MOVE &TO,&FROM
LCLC &PREFIX
&PREFIX SETC 'FIELD' Statement 1
&NAME ST 2,SAVEAREA
L 2,&PREFIX&FROM Statement 2
&PREFIX SETC 'AREA' Statement 3
ST 2,&PREFIX&TO Statement 4
L 2,SAVEAREA
MEND
-------------------------------------------------------------------
HERE MOVE A,B
-------------------------------------------------------------------
+HERE ST 2,SAVEAREA
+ L 2,FIELDB
+ ST 2,AREAA
+ L 2,SAVEAREA
Statement 1 assigns the character value FIELD to
the SETC symbol &PREFIX. Therefore, &PREFIX is
replaced by FIELD in statement 2. Statement 3 assigns
the character value AREA to &PREFIX.
Therefore, &PREFIX is replaced by AREA,
instead of FIELD, in statement 4.
The following example uses the substring notation in the operand
field of a SETC instruction.
MACRO
&NAME MOVE &TO,&FROM
LCLC &PREFIX
&PREFIX SETC '&TO'(1,5) Statement 1
&NAME ST 2,SAVEAREA
L 2,&PREFIX&FROM Statement 2
ST 2,&TO
L 2,SAVEAREA
MEND
-------------------------------------------------------------------
HERE MOVE FIELDA,B
-------------------------------------------------------------------
+HERE ST 2,SAVEAREA
+ L 2,FIELDB
+ ST 2,FIELDA
+ L 2,SAVEAREA
Statement 1 assigns the substring character value
FIELD (the
first five characters corresponding to symbolic parameter
&TO to
the SETC symbol
&PREFIX. Therefore,
FIELD replaces
&PREFIX in
statement 2.
Notes: - If the COMPAT(SYSLIST) assembler option is not specified, you
can pass
a sublist into a macro definition by assigning the sublist to a SETC
symbol, and then specifying the SETC symbol as an operand in a macro
instruction. However, if the COMPAT(SYSLIST) assembler option is
specified, sublists assigned to SETC symbols are treated as a character
string, not as a sublist.
- Regardless of the setting of the COMPAT(SYSLIST) assembler option,
you cannot pass separate (as opposed to a sublist of) parameters into
a macro definition, by specifying a string of values separated by
commas as the operand of a SETC instruction and then using the SETC
symbol as an operand in the macro instruction. If you attempt to
do this, the operand of the SETC instruction is passed to the macro
instruction as one parameter, not as a list of parameters.