digits, from one to 31, and the sign;
this corresponds to an operand length of
one to 16 bytes.
A decimal zero normally has a plussign, but multiplication, division, and over
flow may produce a zero value with a
minus sign.Such a negative zero is a
valid operand and is treated as equal to
a positive zero byCOMPARE DECIMAL.
The lengths of the two operands speci
fied in the instruction need not be the
same. If necessary, the shorter operand
is considered to be extended with zeros
on the left. Results, however, cannot
exceed the first-operand length as spec
ified in the instruction.
When a carry or leftmost nonzero digits
of the result are lost because the
first-operand field is too short, the
result is obtained by ignoring the over
flow digits, condition code 3 is set,
and, if the decimal-overflow mask bit is
one, a program interruption for decimal
overflow occurs. The operand lengths
alone are not an indication of overflow;
nonzero digits must have been lost
during the operation.
The operands of decimal-arithmetic
instructions should not overlap at all
or should have coincident rightmost
bytes. InZERO AND ADD, the operands
may also overlap in such a manner that
the rightmost byte of the first operand
(which becomes the result) is to the
right of the rightmost byte of the
second operand. For these cases of
proper overlap, the result is obtained
as if operands were processed right to
left. Because the codes for digits and
signs are verified during the perform
ance of the arithmetic, improperly
overlapping operands are recognized as
data exceptions.
Programming Note
A packed decimal number in storage may
be designated as both the first and
second operand of ADDDECIMAL, COMPARE DECIMAL, DIVIDE DECIMAL, MULTIPLY DECI MAL, SUBTRACT DECIMAL, or ZERO AND ADD.
Thus, a decimal number may be added to
itself, compared with itself, and so
forth;SUBTRACT DECIMAL may be used to
set a decimal fieldin storage to zero,
and, forMULTIPLY DECIMAL, a decimal
number may be squared in place.
EDITINGINSTRUCTIONS The editing instructions are EDIT and
EDIT AND MARK. For these instructions,
only the first operand (the pattern) has
an explicitly specified length. The
second operand (the source) is consid
ered to have as many digits as necessary
for the completion of the operation.
Overlapping
instructions
suIts.
operands
yield
for the editing
unpredictable re-EXECUTION OF DECIMAL INSTRUCTIONS During the execution of a decimal
instruction, all bytes of the operands
are not necessarily accessed concurrent
ly, and the fetch and store accesses to
a single location do not necessarily
occur one immediately after the other.
Furthermore, for decimal instructions,
data in source fields may be accessed
more than once, and intermediate values
may be placed in the result field that
may differ from the original operand and
final result values.(See the section
"Storage-Operand Consistency" inChapter 5, "Program Execution.") Thus, in a
multiprocessing configuration, an
instruction such as ADDDECIMAL cannot
be safely used to update a shared stor
age location when the possibility exists
that anotherCPU may also be updating
that location.
OTHERINSTRUCTIONS FOR DECIMAL OPERANDS In addition to the decimal instructions
in this chapter,MOVE NUMERICS and MOVE ZONES are provided for operating on data
of lengths up to 256 bytes in the zoned
format. Two instructions are provided
for converting data between the zoned
and packed formats:PACK transforms
zoned data of lengths up to 16 bytes
into packed data, andUNPACK performs
the reverse transformation.MOVE WITH OFFSET can operate on packed data of
lengths up to 16 bytes. Two
instructions are provided for conversion
between the packed-decimal and signed
binary-integer formats.CONVERT TO BINARY converts packed decimal to
binary, andCONVERT TO DECIMAL converts
binary to packed decimal; the length of
the packed decimal operand of these
instructionsis eight bytes (15 digits
and sign). These seven instructions are
not considered to be decimal
instructions and are described inChap ter 7, "General Instructions." The
editing instructionsin this chapter may
also be used to change data from the
packed to the zoned format.INSTRUCTIONS The decimal instructions and their
mnemonics, formats, and operation codesChapter 8. Decimal Instructions 8-3
this corresponds to an operand length of
one to 16 bytes.
A decimal zero normally has a plus
flow may produce a zero value with a
minus sign.
valid operand and is treated as equal to
a positive zero by
The lengths of the two operands speci
fied in the instruction need not be the
same. If necessary, the shorter operand
is considered to be extended with zeros
on the left. Results, however, cannot
exceed the first-operand length as spec
ified in the instruction.
When a carry or leftmost nonzero digits
of the result are lost because the
first-operand field is too short, the
result is obtained by ignoring the over
flow digits, condition code 3 is set,
and, if the decimal-overflow mask bit is
one, a program interruption for decimal
overflow occurs. The operand lengths
alone are not an indication of overflow;
nonzero digits must have been lost
during the operation.
The operands of decimal-arithmetic
instructions should not overlap at all
or should have coincident rightmost
bytes. In
may also overlap in such a manner that
the rightmost byte of the first operand
(which becomes the result) is to the
right of the rightmost byte of the
second operand. For these cases of
proper overlap, the result is obtained
as if operands were processed right to
left. Because the codes for digits and
signs are verified during the perform
ance of the arithmetic, improperly
overlapping operands are recognized as
data exceptions.
Programming Note
A packed decimal number in storage may
be designated as both the first and
second operand of ADD
Thus, a decimal number may be added to
itself, compared with itself, and so
forth;
set a decimal field
and, for
number may be squared in place.
EDITING
EDIT AND MARK. For these instructions,
only the first operand (the pattern) has
an explicitly specified length. The
second operand (the source) is consid
ered to have as many digits as necessary
for the completion of the operation.
Overlapping
instructions
suIts.
operands
yield
for the editing
unpredictable re-
instruction, all bytes of the operands
are not necessarily accessed concurrent
ly, and the fetch and store accesses to
a single location do not necessarily
occur one immediately after the other.
Furthermore, for decimal instructions,
data in source fields may be accessed
more than once, and intermediate values
may be placed in the result field that
may differ from the original operand and
final result values.
"Storage-Operand Consistency" in
multiprocessing configuration, an
instruction such as ADD
be safely used to update a shared stor
age location when the possibility exists
that another
that location.
OTHER
in this chapter,
of lengths up to 256 bytes in the zoned
format. Two instructions are provided
for converting data between the zoned
and packed formats:
zoned data of lengths up to 16 bytes
into packed data, and
the reverse transformation.
lengths up to 16 bytes. Two
instructions are provided for conversion
between the packed-decimal and signed
binary-integer formats.
binary, and
binary to packed decimal; the length of
the packed decimal operand of these
instructions
and sign). These seven instructions are
not considered to be decimal
instructions and are described in
editing instructions
also be used to change data from the
packed to the zoned format.
mnemonics, formats, and operation codes