Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Symbol length attribute reference HLASM Language Reference SC26-4940-06 |
||||||||||
The length attribute of a symbol can be used as a term. Reference
to the attribute is made by coding L' followed by
the symbol, as in:
The length attribute of BETA is substituted for
the term. When you specify a symbol length attribute reference, you
obtain the length of the instruction or data named by a symbol. You
can use this reference as a term in instruction operands to:
The symbol length attribute reference must be specified according
to the following rules:
The value of the length attribute is normally the length in bytes of the storage area required by an instruction, constant, or field represented by a symbol. The assembler stores the value of the length attribute in the symbol table along with the address value assigned to the symbol. When the assembler encounters a symbol length attribute reference, it substitutes the value of the attribute from the symbol table entry for the symbol specified. The assembler assigns the length attribute values to symbols in
the name field of instructions as follows:
For assembler instructions such as DC, DS, and EQU, the length attribute of the location counter reference (L'* — see 6 in Table 1) is equal to 1. For machine instructions, the length attribute of the location counter reference (L'* — see 7 in Table 1) is equal to the length attribute of the instruction in which the L'* appears.
The following example shows how to use the length attribute to
move a character constant into either the high-order or low-order
end of a storage field.
A1 names a storage field eight bytes in length and is assigned a length attribute of 8. B2 names a character constant 2 bytes in length and is assigned a length attribute of 2. The statement named HIORD moves the contents of B2 into the first 2 bytes of A1. The term L'B2 in parentheses provides the length specification required by the instruction. The statement named LOORD moves the contents of B2 into the rightmost 2 bytes of A1. The combination of terms A1+L'A1-L'B2 adds the length of A1 to the beginning address of A1, and subtracts the length of B2 from this value. The result is the address of the seventh byte in field A1. The constant represented by B2 is moved into A1 starting at this address. L'B2 in parentheses provides the length specification in both instructions. For ease in following the preceding example, the length attributes
of A1 and B2 are specified explicitly
in the DS and DC statements that define them. However, keep in mind
that the L'symbol term makes coding such as this possible in situations
where lengths are unknown. For example:
|
Copyright IBM Corporation 1990, 2014
|