Compare Decimal CP 55 F9
B1 I D1 I B2 IJ[5J 7 8 11 12 1516 1920 3132 35 36 47 The first operand is compared with the second, and
the condition code indicates the comparison result.
Comparison is right to left, taking into account the
sign and all digits of both operands. All signs and
digits are checked for validity. If the fields are un­
equal in length, the shorter is extended with high­
order zeros. A positive zero compares equal to a nega­
tive zero. Neither operand is changed as a result of
the operation. Overflow cannot occur in this operation.
The first and second fields may overlap when their
low-order bytes coincide. It is possible, therefore, to
compare a number to itself.
Resulting Condition Code:
o Operands equal
1 First operand is low
2 First operand is high
3
Program Interruptions:
Operation (if decimal feature is not installed)
Addressing
Data
Programming Note
The COMPARE DECIMAL is unique in processing from
right to left; taking signs, zeros, and invalid characters
into account; and extending variable-length fields
when they are unequal in length. Multiply Decimal MP 55 Fe
78 11 12 1516
The product of the multiplier (the second operand)
and the multiplicand (the first operand) replaces the
multiplicand.
The multiplier size is limited to 15 digits and sign
and must be less than the multiplicand size. Length
code L2, larger than seven, or larger than or equal to
the length code Ll, is recognized as a specification ex­
ception. The operation is suppressed and a program
interruption occurs. Since the number of digits in the product is the sum
of the number of digits in the operands, the multi­
plicand must have high-order zero digits for at least
a field size that equals the multiplier field size; other-
wise, a data exception is recognized, and a program
interruption occurs. This definition of the multiplicand
field ensures that no product overflow can occur. The
maximum product size is 31 digits. At least one high­
order digit of the product field is zero.
All operands and results are treated as signed in­
tegers, right-aligned in their field. The sign of the
product is determined by the rules of algebra from the multiplier and multiplicand signs, even if one or
both operands are zero.
The multiplier and product fields may overlap when
their low-order bytes coincide.
Condition Code: The code remains unchanged.
Program Inte1'ruptions:
Operation (if decimal feature is not installed)
Addressing
Protection
Specification
Data
Programming Note
When the multiplicand does not have the desired
number of leading zeros, multiplication may be pre­
ceded by a ZERO AND ADD into a larger field.
Divide Decimal DP 55 FD
7 8 11 12 1516
The dividend (the first operand) is divided by the
divisor (the second operand) and replaced by the
quotient and remainder.
The quotient field is placed leftmost in the first op­
erand field. The remainder field is placed rightmost in
the first operand field and has a size equal to the di­
visor size. Together, the quotient and remainder oc­
cupy the entire dividend field; therefore, the address
of the quotient field is the address of the first oper­
and. The size of the quotient field in eight-bit bytes
is Ll -L2, and the length code for this field is one
less (Ll -L2 -1). When the divisor length code
is larger than seven (15 digits and sign) or larger
than or equal to the dividend length code, a specifi­
cation exception is recognized. The operation is sup­
pressed, and a program interruption occurs.
The dividend, divisor, quotient, and remainder are
all signed integers, right-aligned in their fields. The
sign of the quotient is determined by the rules of al­
gebra from dividend and divisor signs. The sign of the
remainder has the same value as the dividend sign.
These rules are true even when quotient or remainder
is zero.
Decimal Arithmetic 37
Overflow cannot occur. A quotient larger than the
number of digits allowed is recognized as a decimal­
divide exception. The operation is suppressed, and a
program interruption occurs. Divisor and dividend re­
main unchanged in their storage locations.
The divisor and dividend fields may overlap only if
their low··order bytes coincide. Condition Code: The code remains unchanged. Program Interruptions: Operation (if decimal feature is not installed)
Addressing
Protection
Specification
Data
Decimal divide
Programming Note
The maximum dividend size is 31 digits and sign.
Since the smallest remainder size is one digit and sign,
the maximum quotient size is 29 digits and sign.
The condition for a divide exception can be deter­
mined by a trial subtraction. The leftmost digit of the
divisor field is aligned with the leftmost-less-one digit
of the dividend field. When the divisor, so aligned, is
less than or equal to the dividend, a divide exception
is indicated.
A decimal-divide exception occurs if the dividend
does not have at least one leading zero.
Pack
PACK 55 F2
7 8 11 12 1516
The format of the second operand is changed from
zoned to packed, and the result is placed in the first
operand location.
The second operand is assumed to have the zoned
format. All zones are ignored, except the zone over the
low-order digit, which is assumed to represent a sign.
The sign is placed in the right four bits of the low­
order byte, and the digits are placed adjacent to the
sign and to each other in the remainder of the result
field. The sign and digits are moved unchanged to the
first operand field and are not checked for valid codes.
The fields are processed right to left. If necessary,
the second operand is extended with high-order zerO's.
If the first operand field is too short to contain all
significant digits of the second operand field, the re­
maining digits are ignored. Overlapping fields may
occur and are processed by storing each result byte
immediately after the necessary operand bytes are
fetched.
38
Condition Code: The code remains unchanged. Program Interruptions:
Protection
Addressing
Unpack
UNPK SS F3
7 8 11 12 1516
The format of the second operand is changed from
packed to zoned, and the result is placed in the first
aperand lacation.
The digits and sign of the packed operand are
placed unchanged in the first operand location, using
the zoned format. Zones with coding 1111 in the bin­
aJ'y-coded-decimal mode and coding 0101 in the ASCII made are supplied for all bytes, except the low-order
byte, which receives the sign of the packed operand.
The operand sign and digits are not checked for valid
codes.
The fields are processed right to left. The second
operand is extended with zero digits before unpack­
ing, if necessary. If the first operand field is too short
to contain all significant digits of the second operand,
the remaining digits are ignored. The first and second
operand fields may overlap and are processed by stor­
ing a result byte immediately after the necessary op­
erand bytes are fetched.
Condition Code: The code remains unchanged. Program Interruptions:
Addressing
Protection
Move with Offset MVO 55 __ Fl __ 7 8 11 12 15 16 1920 31 32 35 36 47
The second operand is placed to the left of and ad­
jacent to the low-order four bits of the first operand.
The low-order four bits of the first operand are at­
tached as low-order bits to the second operand, the
second operand bits are offset by four bit positions,
and the result is placed in the first operand location.
The first and second operand bytes are not checked
for valid codes.
The fields are processed right to left. If necessary,
the second operand is extended with high-order zerO's.
Previous Page Next Page