ADD DECIMAL
AP [S5]
'FA'I L, I L, I B, I I B, I o 8 12 16 20 32 36 47
The second operand is added to the first
operand, and the resulting sum is placed
at the first-operand location. The
operands and result are in the packed
format.
Addition is algebraic, taking into
account the signs and all digits of both
operands. All sign and digit codes are
checked for validity.
If the first operand is too short to
contain all leftmost nonzero digits of
the sum, decimal overflow occurs. The
operation is completed. The result;s
obtained by ignoring the overflow
digits, and condition code 3 is set. If
the decimal-overflow mask is one, a
program interruption for decimal over
flow occurs.
The sign of the sum is determined by the
rules of algebra. In the absence of
overflow, the sign of a zero result is
made positive. If overflow occurs, a
zero result is given either a positive
or negative sign, as determined by what
the sign of the correct sum would have
been.
Resulting ConditionCode: o Result zero; no overflow
1 Result less than zero; no over
flow
2 Result greater than zero; no
overflow3 Overflow Program Exceptions:
Access (fetch, operand 2; fetch and
store, operand 1)
Data
Decimal overflowProgramming Note
An example of the use of the ADD DECIMAL
instruction is given in Appendix A.COMPARE DECIMAL CP [S5]
'F9'I L, I L, I B, I B, I o 8 12 16 20 32 36 47
The first operand is compared with the
second operand, and the result is indi
cated in the condition code. The oper
ands are in the packed format.
Comparison is algebraic and follows the
procedure for decimal subtraction,
except that both operands remain
unchanged. When the difference ;s zero,
the operands are equal. When a nonzero
difference is positive or negative, the
first operand is high or low, respec
tively.
Overflow cannot occur
difference is discarded.
because the
All sign and digit codes are checked for
validity.
ResultingCondition Code: o Operands equal
1 First operand low
2 First operand high
3Program Exceptions:
Access (fetch, operands 1 and 2)
DataProgramming Notes
1. An example of the use of theCOMPARE DECIMAL instruction is
given in Appendix A.
2. The preferred and alternate sign
codes for a particular sign are
treated as equivalent for compar
ison purposes.
3. A negative zero and a positive zero
compare equal.
DIVIDEDECIMAL DP [55)
'FD'I L, I L, I B, I I B, I o 8 12 16 20 32 36 47
The first operand (the dividend) is
divided by the second operand (the divi
sor). The resulting quotient andChapter 8. Decimal Instructions 8-5
AP [S5]
'FA'
The second operand is added to the first
operand, and the resulting sum is placed
at the first-operand location. The
operands and result are in the packed
format.
Addition is algebraic, taking into
account the signs and all digits of both
operands. All sign and digit codes are
checked for validity.
If the first operand is too short to
contain all leftmost nonzero digits of
the sum, decimal overflow occurs. The
operation is completed. The result;s
obtained by ignoring the overflow
digits, and condition code 3 is set. If
the decimal-overflow mask is one, a
program interruption for decimal over
flow occurs.
The sign of the sum is determined by the
rules of algebra. In the absence of
overflow, the sign of a zero result is
made positive. If overflow occurs, a
zero result is given either a positive
or negative sign, as determined by what
the sign of the correct sum would have
been.
Resulting Condition
1 Result less than zero; no over
flow
2 Result greater than zero; no
overflow
Access (fetch, operand 2; fetch and
store, operand 1)
Data
Decimal overflow
An example of the use of the ADD DECIMAL
instruction is given in Appendix A.
'F9'
The first operand is compared with the
second operand, and the result is indi
cated in the condition code. The oper
ands are in the packed format.
Comparison is algebraic and follows the
procedure for decimal subtraction,
except that both operands remain
unchanged. When the difference ;s zero,
the operands are equal. When a nonzero
difference is positive or negative, the
first operand is high or low, respec
tively.
Overflow cannot occur
difference is discarded.
because the
All sign and digit codes are checked for
validity.
Resulting
1 First operand low
2 First operand high
3
Access (fetch, operands 1 and 2)
Data
1. An example of the use of the
given in Appendix A.
2. The preferred and alternate sign
codes for a particular sign are
treated as equivalent for compar
ison purposes.
3. A negative zero and a positive zero
compare equal.
DIVIDE
'FD'
The first operand (the dividend) is
divided by the second operand (the divi
sor). The resulting quotient and