You can use a sublist in a positional or keyword operand to specify several values. A sublist is a character string that consists of one or more entries separated by commas and enclosed in parentheses.
If the COMPAT(SYSLIST) assembler option is not specified, a variable symbol that has been assigned a character string that consists of one or more entries separated by commas and enclosed in parentheses is also treated as a sublist. However, if the COMPAT(SYSLIST) assembler option is specified, a sublist assigned to a variable symbol is treated as a character string, not as a sublist.
A variable symbol is not treated as a sublist if the parentheses are not present. The following example shows two calls to macro MAC1. In the first call, the value of the operand in variable &VAR1 is treated as a sublist. In the second call, the value of the operand is treated as a character string, not a sublist, because the variable &VAR2 does not include parentheses.
&VAR1 SETC '(1,2)'
MAC1 KEY=&VAR1
&VAR2 SETC '1,2'
MAC1 KEY=(&VAR2)
To refer to an entry of a sublist code, use:
Figure 32 shows that the value specified in a positional or keyword operand can be a sublist.
A symbolic parameter can refer to the whole sublist (see 1 in Figure 32), or to an individual entry of the sublist. To refer to an individual entry, the symbolic parameter (see 2 in Figure 32) must have a subscript whose value indicates the position (see 3 in Figure 32) of the entry in the sublist. The subscript must have a value greater than or equal to 1.
A sublist, including the enclosing parentheses, must not contain more than 1024 characters. It consists of one or more entries separated by commas and enclosed in parentheses; for example, (A,B,C,D,E). () is a valid sublist with the null character string as the only entry.
MACRO
SUBLISTS &P1,&P2,&KEY=(F0,F,0)
. ^ Refers to default value
. *--- 3 --* in keyword operand
. |
&KEY(1) DC &KEY(2)'&KEY(3)'
.
. *------------ 3 Refers to value in
&P1(1) DC &P1(2)'&P1(3)' | positional operand
. 2 |
. |
DC A&P2 |
. | |
. *--------------- 1 |
MEND | |
----------------------------------+------+-------------------------------
OPEN START 0 | |
. V |
. *-----* |
SUBLISTS (H20,H,200),(A,B,C) |
. ^ |
. *--------------*
.
+F0 DC F'0'
.
.
+H20 DC H'200'
.
.
+ DC A(A,B,C)
.
.
ENDTable 48 shows the relationship between subscripted parameters and sublist entries if:
&SYSLIST(n,m): The system variable symbol, &SYSLIST(n,m), can also refer to sublist entries, but only if the sublist is specified in a positional operand.
[ Top of Page | Previous Page | Next Page | Contents | Index ]