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:

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.

Figure 32. Sublists in operands
          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)
          .
          .
          END

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

Table 48. 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.

[ Top of Page | Previous Page | Next Page | Contents | Index ]