Decimal arithmetic operates on data in the packed
format. In this format, two decimal digits are placed
in one eight-bit byte.
cated to or from external devices in the zoned format
(which has one digit in an eight-bit byte), the neces
sary format-conversion operations are also provided
in this instruction group.
Data are interpreted as integers, right-aligned in
their fields. They are kept in true notation with a sign
in the low-order eight-bit byte.
Processing takes place right to left between main
storage locations. All decimal arithmetic instructions
use a two-address format. Each address specifics the
leftmost byte of an operand. Associated with this ad
dress is a length field, indicating the number of addi
tional bytes that the operand extends beyond the first
The decimal arithmetic instruction set provides for
adding, subtracting, comparing, multiplying, and di
viding, as well as the format conversion of variable
length operands. Most decimal instructions are part of
the decimal feature.
The condition code is set as a result of all add-type
and comparison operations.
Decimal operands reside in main storage only. They
are composed of one to 16 eight-bit bytes.
Lengths of the two operands specified in an instruc
tion need not be the same. If necessary they are con
sidered to be extended with zeros to the left of the
high-order digits. Results never exceed the limits set
by address and length specification. Lost carries or
lost digits from arithmetic operations are signaled as
a decimal overflow exception.
the packed or zoned format.
placed adjacent in a byte, except for the rightmost
byte of the field. In the rightmost byte a sign is placed
to the right of decimal digit. Both digits and a sign
arc encoded and occupy four bits each.
the numeric, are normally occupied by a decimal digit.
The four high-order bits of a byte are called the zone,
except for the rightmost byte of the field, where nor
mally the sign occupies the zone position.
Arithmetic is performed with operands and results
in the packed format. In the zoned format, the digits
are represented as part of an alphameric character
set. A PACK instruction is provided to transform zoned
data into packed data, an an UNPACK instruction per
forms the reverse transformation. Moreover, the edit
ing instructions may be used to change data from
packed to zoned.
The fields specified in decimal arithmetic other than
in PACK, UNPACK, and
not overlap at all or should have coincident rightmost
overlap to the right of the source field. Because the
code configurations for digits and sign are verified
during arithmetic, improper overlapping fields are
recognized as data exceptions. In move-type oper
ations, the operand digits and signs are not checked,
and the operand fields may overlap without any re
The rules for overlapped fields are established for
the case where operands are fetched right to left from
storage, eight bits at a time, just before they are pro
cessed. Similarly, the results are placed in storage,
eight bits at a time, as soon as they are generated.
Actual processing procedure may be considerably dif
ferent because of the use of preferred storage for in
termediate results. Nevertheless, the same rules are
Numbers are represented as right-aligned true integ
ers with a plus or minus sign.