The number attribute applies to the operands of macro instructions
and subscripted SET symbols.
When applied to a macro operand, the number attribute is a numeric
value equal to the number of sublist entries.
When applied to a subscripted SET symbol, the number attribute
is equal to the highest element to which a value has been assigned
in a SETx instruction. Consider the example in
Figure 1.
Figure 1. Number attribute reference 1 macro
2 MAC1 &op1
3 lcla &SETSUB(100)
4 &SETSUB(5) seta 20,,,70
5 &B seta N'&SETSUB
6 &C seta N'&op1
7 DC C'Highest referenced element of SETSUB = &B'
8 DC C'Number of sublist entries in OP1 = &C'
9 mend
000000 00000 0004C 10 a csect
11 MAC1 (1,(3),(4))
000000 C889878885A2A340 12+ DC C'Highest referenced element of SETSUB = 8'
000028 D5A4948285994096 13+ DC C'Number of sublist entries in OP1 = 3'
14 end
N'&op1 is equal to 3 because there are
three subscripts in the macro operand in statement 11:
1,
(3),
and
(4).
N'&SETSUB is equal to 8 because
&SETSUB(8),
assigned the value 70 in statement 4, is the highest referenced element
of the &SETSUB array entries.
Notes: - The number attribute reference can be used only in arithmetic
expressions.
- N'&SYSLIST refers to the number of positional operands in
a macro instruction, and N'&SYSLIST(n)
refers to the number of sublist entries in the n-th
operand.
- For positional macro parameters, either explicitly named or implicitly
named as &SYSLIST(n):
- If the first character of an operand is a left parenthesis, count
the number of unquoted and unnested commas between it and the next
matching right parenthesis. That number plus one is the number attribute
of the operand.
- If there is no initial left parenthesis, the number attribute
is one.
- For all other system variable symbols, the number attribute value
is always one. This is also true for &SYSMAC. The range of the
subscript for &SYSMAC is 0 - &SYSNEST.
- N' is always zero for unsubscripted set symbols. The number attribute
(N'), when used with a macro instruction operand, examines its list
structure, not the number of characters in the operand. (The number
of characters is determined by the count (K') attribute.)