Length attribute (L')
The length attribute has a numeric value equal to the number of bytes occupied by the data that is named by the symbol specified in the attribute reference.
Evaluation of length attribute references for conditional assembly statements is handled differently from references in ordinary assembly.
In conditional assembly statements, the operand of a length attribute reference must be either an ordinary symbol whose length attribute is either known, or can be determined in lookahead mode (Figure 1); or it must be a variable symbol whose value is that of an ordinary symbol satisfying the same rules.
In ordinary assembly statements, the operand of a length attribute reference can be a character-valued conditional assembly expression whose value is that of an ordinary symbol.
&B SETC 'B'
AB DC C'A&B' Valid in ordinary assembly
LAB DC AL1(L'A&B) Valid in ordinary assembly
&N SETA L'A&B Invalid in conditional assembly
&T1 SETB (L'A&B EQ 2) Invalid in conditional assembly
&T2 SETB (2 EQ L'A&B) Invalid in conditional assembly
The two SETB statements receive different diagnostic messages, because the errors are detected during different parts of the assembler's analysis of the SETB expressions.
In conditional assembly statements, the operand of a length attribute reference must be an ordinary or variable symbol, and not a character expression.
The length attribute can also be specified outside conditional assembly instructions. Then, the length attribute value is not available for conditional assembly processing, but is used as a value at assembly time.
000000 E740 1 CSYM DC CL(L'ZLOOKAHEAD)'X' Length resolved later
2 &LEN SETA L'CSYM
** ASMA042E Length attribute of symbol is unavailable; default=1
3 DC C'&LEN ' REAL LENGTH NOT AVAILABLE
000002 F140 + DC C'1 ' REAL LENGTH NOT AVAILABLE
4 &TYP SETC T'CSYM
5 DC C'&TYP ' TYPE IS KNOWN
000004 C340 + DC C'C ' TYPE IS KNOWN
6 &DEF SETA D'CSYM
7 DC C'&DEF ' SYMBOL IS DEFINED
000006 F140 + DC C'1 ' SYMBOL IS DEFINED
8 &LEN SETA L'zlookahead Length resolved immediately
9 CSYM2 DC CL(&len)'X'
000008 E740 +CSYM2 DC CL(2)'X'
10 &LEN SETA L'CSYM2
11 DC C'&LEN ' REAL LENGTH NOW AVAILABLE
00000A F240 + DC C'2 ' REAL LENGTH NOW AVAILABLE
00000C 0001 12 ZLOOKAHEAD DC H'1'
13 END
In statement 2 the length of CSYM
has not been
established because the definition of CSYM
in statement
1 is not complete. The reference to the length attribute results in
a length of 1 and error message ASMA042E. However, statement 5 shows
that the type attribute is assigned, and statement 7 shows that the
defined attribute is assigned. In comparison, the length attribute
for symbol CSYM2
is available immediately, as it
was retrieved indirectly using the conditional assembly instruction
in statement 8.
- If the first operand of the EQU instruction is a self-defining term, the length attribute value is 1.
- If the first operand of the EQU instruction is a symbol whose value and length attribute are defined, the length attribute value is that of the symbol in the first operand.
- If the first operand of the EQU instruction is a defined symbol and the EQU instruction specifies a length value in the second operand, the length attribute value is that of the second operand.
- The length attribute reference, when used in conditional assembly processing, can be specified only in arithmetic expressions.
- When used in conditional assembly processing, a length attribute reference to a symbol with the type attribute value of M, N, O, T, U, or $ is flagged. The length attribute for the symbol has the default value of 1.