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 38); 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.
The following example may help to clarify this distinction:
&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.
Figure 38 is an example showing the evaluation of the length attribute for an assembler instruction in statement 1 and for a conditional assembly instruction in statement 8.
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 ENDIn 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.
During conditional assembly, an ordinary symbol used in the name field of an EQU instruction has a length attribute value that depends on the order of the symbol's definition and the reference to its length attribute.
At assembly time, the symbol has the same length attribute value as the first term of the expression in the first operand of the EQU instruction. However, the second operand of an EQU instruction can be used to assign a length attribute value to the symbol in the name field. This second operand can not be a forward reference to another EQU instruction.
[ Top of Page | Previous Page | Next Page | Contents | Index ]