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.
If the first operand field is too short to contain all
bytes of the second operand, the remaining informa­
tion is ignored. Overlapping fields may occur and are
processed by storing a result byte as soon as the neces­
sary operand bytes are fetched.
Condition Code: The code remains unchanged. Program Interruptions: Protection Addressing
Programming Note
The instruction set for decimal arithmetic includes no
shift instructions since the equivalent of a shift can be
obtained by programming. Programs for right or left
shift and for an even or odd shift amount may be writ­
ten with MOVE WITn OFFSET and the logical move in­
structions.
Decimal Arithmetic Exceptions
Exceptional instructions, data, or results cause a pro­
gram interruption. When the interruption occurs, the
current psw is stored as an old PSW, and a new psw is
obtained. The interruption code in the old psw identi­
fies the cause of the interruption. The following ex­
ceptions cause a program interruption in decimal
arithmetic.
Operation: The decimal feature is not installed and
the instruction is ADD DECIMAL, SUBTRACT DECIMAL, ZERO AND ADD, COMPARE DECIMAL, MULTIPLY DECIMAL,
or DIVIDE DECIMAL. The instruction is suppressed.
Therefore, the condition code and data in storage and
registers remain unchanged. Protection: The storage key of a result location does
not match the protection key in the psw.
Addressing: An address designates a location out­
side the available storage for the installed system.
In the two preceding exceptions, the operation is
terminated. The result data and the condition code
are unpredictable and should not be used for further
computation.
These address exceptions do not apply to the com­
ponents from which an address is generated -the
contents of the Dl and D2 fields and the contents of
the registers specified by Bl and B 2 Specifications: A multiplier or a divisor size ex­
ceeds 15 digits and sign or exceeds the multiplicand
or dividend size. The instruction is suppressed;
therefore, the condition code and data in storage and
registers remain unchanged.
Data: A sign or digit code of an operand in ADD
DECIMAL, SUBTRACT DECIMAL, ZERO AND ADD, COMPARE DECIMAL, MULTIPLY DECIMAL, or DIVIDE DECIMAL is in­
correct, a multiplicand has insufficient high-order
zeros, or the operand fields in these operations overlap
incorrectly. The operation is terminated. The result
data and the condition code are unpredictable and
should not be used for further computation.
Decimal Overflow: The result of ADD DECIMAL, SUB­ TRACT DECIMAL, or ZERO AND ADD overflows. The pro­
gram interruption occurs only when the decimal-over­ flow mask bit is one. The operation is completed by
placing the truncated low-order result in the result
field and setting the condition code to 3. The sign and
low-order digits contained in the result field are the
same as they would have been for an infinitely long
result field.
Decimal Divide Check: The quotient exceeds the
specified data field, including division by zero. Di­
vision is suppressed. Therefore, the dividend and
divisor remain unchanged in storage.
Decimal Arithmetic 39
Previous Page Next Page