Data Format. . Zoned Format
Packed Format
Number Representation
Instructions .
ADDDECIMAL. .
COMPAREDECIMAL DIVIDE DECIMAL. EDIT .... EDIT AND MARK. . MULTIPLY DECIMAL. Contents SHIFT AND ROUND DECIMAL. SUBTRACT DECIMAL ZERO AND ADD .
Decimal instructions provide arithmetic, shifting, and
editing operations on decimal data. These instruc
tions constitute the decimal feature.
Data Format
Decimal operands reside in main storage and may be
in either the zoned or packed format.
Zoned Format
In the zoned format, the rightmost four bits of a
byte are called the numeric (N) and normally com
prise a code representing a decimal digit. The left
most four bits of a byte are called the zone (Z), ex
cept for the rightmost byte of the field, where these
bits may be treated either as a zone or as a sign(S) code.
Packed FormatI DID 1 DID 1 DID 1 Dis
In the packed format, each byte contains two deci
mal digits (D), except for the rightmost byte, which
contains a sign to the right of a decimal digit. The
digit and sign codes each comprise four bits.
Arithmetic and shifting are performed with oper
ands in the packed format and generate results in
the packed format. Decimal numbers in the zoned,
format are represented as part of an alphameric char
acter set, which includes also alphabetic and special
Decimal Instructions
147
147
147
148
148
149
149
149150 152
153
153
154
155
characters. The zoned format is usually produced by
source-document input devices, such as a card read
er, and is usually used for printing decimal data on
an output device.
The instructionsMOVE ZONES and MOVE NUMERICS are provided for operating on data in
the zoned format. Two instructions are provided for
converting data between the zoned and packed for
mats: thePACK instruction transforms zoned data
into packed data, andUNPACK performs the re verse transformation. These four instructions are not
part of the decimal feature and are described in the
chapter" General Instructions." The instructions
EDIT and EDIT AND MARK may also be used to
change data from the packed to the zoned format.
Decimal operands occupy fields in main storage
that start on a byte boundary. For all decimal in
structions other than EDIT and EDIT AND MARK,
the operands are in the packed format and are com
posed of one to sixteen 8-bit bytes. For the two edit
ing instructions, operands of up to 256 bytes in
length can be designated.
F or the decimal arithmetic instructions, the
lengths of the two operands specified in the instruc
tion need not be the same. If necessary, the oper
ands are considered to be extended with zeros to
the left of the high-order digit. Results, however,
never exceed the first-operand field size as specified
in the instruction. When a carry or high-order signif
icant digits are lost because the first-operand field is
too small, a program interruption for decimal over
flow occurs, provided the decimal-overflow mask bit
is one. For the two editing instructions, only one
operand (the pattern) has an explicitly specified
length; the other operand (the source) is considered
Decimal Instructions 147
Packed Format
Number Representation
Instructions .
ADD
COMPARE
Decimal instructions provide arithmetic, shifting, and
editing operations on decimal data. These instruc
tions constitute the decimal feature.
Data Format
Decimal operands reside in main storage and may be
in either the zoned or packed format.
Zoned Format
In the zoned format, the rightmost four bits of a
byte are called the numeric (N) and normally com
prise a code representing a decimal digit. The left
most four bits of a byte are called the zone (Z), ex
cept for the rightmost byte of the field, where these
bits may be treated either as a zone or as a sign
Packed Format
In the packed format, each byte contains two deci
mal digits (D), except for the rightmost byte, which
contains a sign to the right of a decimal digit. The
digit and sign codes each comprise four bits.
Arithmetic and shifting are performed with oper
ands in the packed format and generate results in
the packed format. Decimal numbers in the zoned,
format are represented as part of an alphameric char
acter set, which includes also alphabetic and special
Decimal Instructions
147
147
147
148
148
149
149
149
153
153
154
155
characters. The zoned format is usually produced by
source-document input devices, such as a card read
er, and is usually used for printing decimal data on
an output device.
The instructions
the zoned format. Two instructions are provided for
converting data between the zoned and packed for
mats: the
into packed data, and
part of the decimal feature and are described in the
chapter" General Instructions." The instructions
EDIT and EDIT AND MARK may also be used to
change data from the packed to the zoned format.
Decimal operands occupy fields in main storage
that start on a byte boundary. For all decimal in
structions other than EDIT and EDIT AND MARK,
the operands are in the packed format and are com
posed of one to sixteen 8-bit bytes. For the two edit
ing instructions, operands of up to 256 bytes in
length can be designated.
F or the decimal arithmetic instructions, the
lengths of the two operands specified in the instruc
tion need not be the same. If necessary, the oper
ands are considered to be extended with zeros to
the left of the high-order digit. Results, however,
never exceed the first-operand field size as specified
in the instruction. When a carry or high-order signif
icant digits are lost because the first-operand field is
too small, a program interruption for decimal over
flow occurs, provided the decimal-overflow mask bit
is one. For the two editing instructions, only one
operand (the pattern) has an explicitly specified
length; the other operand (the source) is considered
Decimal Instructions 147