HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Sublists in operands

HLASM Language Reference
SC26-4940-06

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 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 1. 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 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)¹
(A)¹
(A)¹

()¹
()¹
()¹
(A)
A
Null character string

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

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

( )²
Nothing³

Nothing³
     &PARM1
     &PARM2(3)
     &SYSLIST(2,3)
A,(1,2,3,4)⁴
A,(1,2,3,4)⁴
A,(1,2,3,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.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014