HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


General rules for using literals

HLASM Language Reference
SC26-4940-06

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 can 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 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:
  1. A literal which contains a location counter reference is not identical to any other literal.
  2. Otherwise, two literals are identical (and are generated only once), if their source forms are identical.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014