You can use literals as operands in order to introduce data into your program. The literal is a special type of relocatable term. It behaves like a symbol in that it represents data. However, it is a special kind of term because it also is used to define the constant specified by the literal. This is convenient because:
The assembler assembles the data item specified in a literal into a literal pool (See Literal pool). It then assembles the address of this literal data item in the pool into the object code of the instruction that contains the literal specification. Thus, the assembler saves you a programming step by storing your literal data for you. The assembler also organizes literal pools efficiently, so that the literal data is aligned on the correct boundary alignment and occupies a minimum amount of space.
Literals, constants, and self-defining terms differ in three important ways:
Figure 9 shows examples of the differences between literals, constants, and self-defining terms.
L 3,=F'33' Register 3 set to 33. See note 1 L 3,F33 Register 3 set to 33. See note 2 . . . F33 DC F'33'
MVC FLAG,=X'00' FLAG set to X'00'. See note 1 MVI FLAG,X'00' FLAG set to X'00'. See note 3 MVI FLAG,ZERO FLAG set to X'00'. See note 4 . . . FLAG DS X ZERO EQU X'00'
LA 4,LOCORE Register 4 set to 1000. See note 4 LA 4,1000 Register 4 set to 1000. See note 3 . . . LOCORE EQU 1000
You can specify a literal as either a complete operand in a machine instruction, or as part of an expression in the operand of a machine instruction. A literal can also be specified as the name field on a macro call instruction.
Because literals define read-only data, they must not be used in operands that represent the receiving field of an instruction that modifies storage.
The assembler requires a description of the type of literal being specified as well as the literal itself. This descriptive information assists the assembler in assembling the literal correctly. The descriptive portion of the literal must indicate the format of the constant. It can also specify the length of the constant.
The method of describing and specifying a constant as a literal is nearly identical to the method of specifying it in a single operand of a DC assembler instruction. The only difference is that the literal must start with an equal sign (=), which indicates to the assembler that a literal follows. The length of the literal, including the equal sign, constant type and modifiers, delimiters, and nominal values is limited to a maximum of 256 characters.
A literal may be coded as indicated here:
=10XL5'F3'
where the subfields are:
Duplication factor 10 Type X Modifiers L5 Nominal value 'F3'
The following instruction shows one use of a literal:
GAMMA L 10,=F'274'
The statement GAMMA is a load instruction using a literal as the second operand. When assembled, the second operand of the instruction refers to the relative address at which the value F'274' is stored.
You cannot rely on the ordering of literals in the literal pool remaining the same. For this reason, referring to a point that extends beyond the bounds of a literal is flagged with warning message ASMA015W. Here is an example of such a reference:
BETA L 10,=F'274'+4
In general, literals can be used wherever a storage address is permitted as an operand, including in conjunction with an index register in instructions with the RX format. For example:
DELTA LH 5,=H'11,23,39,48,64'(6)
is equivalent to:
DELTA LH 5,LENGTHS(6) . . . LENGTHS DC H'11,23,39,48,64'
See DC instruction for a description of how to specify the subfields in a literal.
Literals cannot be used in any assembler instruction where a previously defined symbol is required, but length attribute references to previously defined literals are allowed. Literals are relocatable terms because the address of the literal, rather than the literal-generated constant itself, is assembled in the statement that references a literal. The assembler generates the literals, collects them, and places them in a specific area of storage, as explained under Literal pool. Because the assembler determines the order in which literals are placed in the literal pool, the effect of using two literals as paired relocatable terms (see Paired relocatable terms) is unpredictable.
Location counter reference describes how you can use the current location counter in a literal.
The rules for determining whether two literals are identical are:
You should not confuse a literal with the immediate data in an SI instruction. Immediate data is assembled into the instruction.
The literals processed by the assembler are collected and placed in a special area called the literal pool. You can control the positioning of the literal pool. Unless otherwise specified, the literal pool is placed at the end of the first control section.
You can also specify that multiple literal pools be created. However, the assembler controls the sequence in which literals are ordered within the pool. Further information on positioning literal pools is in LTORG instruction.
[ Top of Page | Previous Page | Next Page | Contents | Index ]