Sublists in operands

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:
  • The corresponding symbolic parameter with an applicable subscript.
  • The system variable symbol &SYSLIST with applicable subscripts, the first of which refers to the positional operand, and the second to the sublist entry in the operand. &SYSLIST can refer only to sublists in positional operands.

Figure 1 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 1), or to an individual entry of the sublist. To refer to an individual entry, the symbolic parameter (see  2  in Figure 1) must have a subscript whose value indicates the position (see  3  in Figure 1) 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 4064 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.
Figure 1. Sublists in operands
Table 1 shows the relationship between subscripted parameters and sublist entries if:
  • A sublist entry is omitted (see  1  in Table 1).
  • The subscript refers past the end of the sublist (see 2  in Table 1).
  • The value of the operand is not a sublist (see  3  in Table 1).
  • The parameter is not subscripted (see  4  in Table 1).

&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.

Table 1. Relationship between subscripted parameters and sublist entries
Parameter
Sublist specified in
corresponding operand
or as default value
of a keyword parameter
Value generated or used in computation
 1   &PARM1(3)
(1,2,,4)
Null character string
 2   &PARM1(5)
(1,2,3,4)
Null character string
     &PARM1
 3   &PARM1(1)
     &PARM1(2)
A
A
A
A
A
Null character string
 4   &PARM1
     &PARM1(1)
 2   &PARM1(2)

     &PARM1
     &PARM1(1)
     &PARM1(2)
(A)1
(A)1
(A)1

()1
()1
()1
(A)
A
Null character string

()
Null character string
Null character string
     &PARM1(2)

     &PARM1(1)
(A, ,C,D)2

( )2
Nothing3

Nothing3
     &PARM1
     &PARM2(3)
     &SYSLIST(2,3)
A,(1,2,3,4)4
A,(1,2,3,4)4
A,(1,2,3,4)4
A
3
3
Notes:
  1. Considered a sublist.
  2. The space indicates the end of the operand field.
  3. Produces error diagnostic message ASMA088E Unbalanced parentheses in macro call operand.
  4. Positional operands.