It seems to me that the real problem is that the assembler is
inconsistent with respect to the evaluation of expressions and using
the result of such an evaluation in various contexts.
The HLASM Language Reference clearly states the requirement of
Immediate Data operands for machine instructions:
Immediate data
In addition to registers, numeric values, relative addresses,
and lengths, some machine instruction operands require
immediate data. Such data is assembled directly into the
object code of the machine instructions. Use immediate data
to specify the bit patterns for masks or other absolute
values you need.
Specify immediate data only where it is required. Do not
confuse it with address references to constants and areas, or
with any literals you specify as the operands of machine
instructions.
Immediate data must be specified as absolute expressions
whose range of values depends on the machine instruction for
which the data is required. The immediate data is assembled
into its binary representation.
The HLASM Language Reference defines an Absolute Expression as shown
below:
Absolute expression: An absolute expression is one whose
value remains the same after program relocation. The value
of an absolute expression is called an absolute value.
An expression is absolute, and is reduced to a single
absolute value if the expression:
1. Comprises a symbol with an absolute value, a
self-defining term, or a symbol length attribute
reference, or any arithmetic combination of absolute
terms. The absolute terms can include Integer and Scale
attributes, but not Type attributes.
2. Contains relocatable terms alone or in combination with
absolute terms, and if all these relocatable terms are
paired.
Paired relocatable terms: An expression can be absolute even
though it contains relocatable terms, if all the relocatable
terms are paired. The pairing of relocatable terms cancels
the effect of relocation.
The assembler reduces paired terms to single absolute terms
in the intermediate stages of evaluation. The assembler
considers relocatable terms as paired under the following
conditions:
. The paired terms must have the same relocatability
attribute.
. The paired terms must have opposite signs after all unary
operators are resolved. In an expression, the paired
terms do not have to be contiguous (that is, other terms
can come between the paired terms).
The assembler permits relocatable expressions in the operands of
Relative Immediate instructions (such as Load Address Relative Long
[LARL], Branch Relative on Condition [BRC], etc.).
For instructions in which one or more operands must be Immediate
Absolute values (such as Compare Logical Immediate [CLI], Load
Halfword Immediate [LHI], etc.), the assembler disallows the use of
"paired relocatable terms" in an Absolute Expression when any of those
terms require creating an entry in the Relocation Dictionary. In my
opinion, this is an unnecessary restriction, but it is what it is.
Bob