Padding and truncation of values
The nominal values specified for constants are assembled
into storage.
The amount of space available for the nominal value of a constant
is determined:
- By the explicit length specified in the
length modifier,
or
- If no explicit length is specified, by the implicit length
according to the type of constant defined (see Appendix B. Summary of constants).
The padding and truncation rules discussed below
apply to single nominal values.
Padding
If more space is specified than is needed to accommodate the
binary representation of the nominal value, the extra space is
padded:
- With binary zeros on the left for the binary (B), hexadecimal
(X), fixed-point (H,F), packed decimal (P), and all address
(A,Y,S,V,J,Q,R) constants
- With sign extension for constants that support
sign extension of the nominal value (H, F, Y, A),
as described in Table 26.
- With ASCII spaces on the right (X'20')
for CE-type character constants.
- With EBCDIC zeros on the left (X'F0') for the zoned
decimal (Z) constants
- With EBCDIC spaces on the right (X'40') for the
character (C) constants
- With EBCDIC spaces on the right (X'40') for the
Unicode character (CU) constant prior to translation
- With double-byte spaces on the right (X'4040') for the
graphic (G) constants
Notes:
- In floating-point constants (E,D,L), the fraction is extended
to
occupy
the extra space available.
- Padding is on the left for all constants except the character
constant and the graphic constant.
Truncation
If less space is available than is needed to accommodate the nominal
value, the nominal value is truncated and part of the constant is lost.
Truncation of the nominal value is:
- On the left for the binary (B), hexadecimal (X), fixed-point
(H and F), and decimal (P
and Z)
- On the right for the character (C) constant,
the Unicode character (CU) constant,
and the graphic (G) constant
- On the left for
absolute or
relocatable address (A and Y),
the external address (V), offset (Q),
length (J) and PSECT address (R) constants.
The actual value stored and any possible
truncation is dependent on the values inserted by the linker/binder
and the length of the constant.
Notes:
- If significant bits are lost in the truncation of fixed-point
constants, error diagnostic message ASMA072E Data item too
large is issued.
- Floating-point constants (E, D, L) are not truncated.
They are rounded to fit the space
available--see
Figure 18 for rounding modes.
- The above rules for padding and truncation also apply when using the
bit-length
modifier
(see Subfield 5: Modifier).
- Double-byte data in C-type constants cannot be truncated because
truncation creates incorrect double-byte data. Error ASMA208E
Truncation into double-byte data is not permitted is issued
if such truncation is attempted.
- Truncation of double-byte data in
CU-type and
G-type constants is permitted
because the length modifier restrictions (see Subfield 5: Modifier)
ensure that incorrect double-byte data cannot be created by truncation.
However, truncating bit-length constants may create
incorrect double-byte data.
[ Top of Page | Previous Page | Next Page | Contents | Index ]