Addition is algebraic, taking into account sign and

all digits of both operands. All signs and digits are

checked for validity. If necessary, high-order zeros are

supplied for either operand. When the first operand

field is too short to contain all significant digits of the

sum, adecimal overflow occurs, and a program inter

ruption is taken provided that the corresponding mask

bit is one.Overflow has two possible causes. The first is the

loss of a carry out of the high-order digit position of

the result field. The second cause is an oversized re

sult, which occurs when the second operand field is

larger than the first operand field and significant result

digits are lost. The field sizes alone are not an indi

cation of overflow.

Thefirst and second operand fields may overlap

when their low-order bytes coincide; therefore, it is

possible to add a number to itself.

The sign of the result is determined by the rules of

algebra. A zero sum is always positive. When high

order digits are lost because of overflow, a zero result

has the sign of the correct sum.

Resulting Condition Code:

o Sum is zero

1 Sum is less than zero

2 Sum is greater than zero

3Overflow Program Interruptions: Operation (if decimal feature is not installed)

Protection

Addressing

DataOverflow Subtract [»ecimal 5P 55

FB

78 11 12 1516

The second operand is subtracted from the first oper

and, and the difference is placed in the first operand

location.

Subtraction is algebraic, taking into account sign

and all digits of both operands. TheSUBTRACf DECIMAL

is similar to ADD DECIMAL, except that the sign of the

second operand is changed from positive to negative

or from negative to positive after the operand is ob

tained from storage and before the arithmetic.

The sign of the result is determined by the rules of

algebra. A zero difference is always positive. When

36

high-order digits are lost because of overflow, a zero

result has the sign of the correct difference.Resulting. Condition Code:

o Difference is zero

1 Difference is less than zero

2 Difference is greater than zero

3Overflow Program Interruptions: Operation (if decimal feature is not installed)

Protection

Addressing

Data

Decimal overflow

Programming Note

The operands ofSUBTRACT DECIMAL may overlap when

their low-order bytes coincide, even when their

lengths are unequal. This property may be used to set

to zero an entire field or the low-order part of aReId. Zero and Add ZAP 55 F8

78 11 12 1516

The second operand is placed in the first operand lo

cation.

The operation is equivalent to an addition to zero.

A zero result is positive. When high-order digits are

lost because of overflow, a zero result has the sign of

the second operand.Only the second operand is checked for valid sign

and digit codes. Extra high-order zeros are supplied

if needed. When theRrst operand Reld is too short to

contain all significant digits of the second operand, a

decimal overflow occurs and results in a program in

terruption, provided that the decimal overflow mask

bit is one. TheRrst and second operand fields may

overlap when the rightmost byte of the first operand

field is coincident with or to the right of the rightmost

byte of the second operand.

Resulting Condition Code:

o Result is zero

1 Result is less than zero

2 Result is greater than zero

3Overflow Program Interruptions: Operation (if decimal feature is not installed)

Addressing

Data

Decimal overflow

Protection

all digits of both operands. All signs and digits are

checked for validity. If necessary, high-order zeros are

supplied for either operand. When the first operand

field is too short to contain all significant digits of the

sum, a

ruption is taken provided that the corresponding mask

bit is one.

loss of a carry out of the high-order digit position of

the result field. The second cause is an oversized re

sult, which occurs when the second operand field is

larger than the first operand field and significant result

digits are lost. The field sizes alone are not an indi

cation of overflow.

The

when their low-order bytes coincide; therefore, it is

possible to add a number to itself.

The sign of the result is determined by the rules of

algebra. A zero sum is always positive. When high

order digits are lost because of overflow, a zero result

has the sign of the correct sum.

Resulting Condition Code:

o Sum is zero

1 Sum is less than zero

2 Sum is greater than zero

3

Protection

Addressing

Data

FB

78 11 12 1516

The second operand is subtracted from the first oper

and, and the difference is placed in the first operand

location.

Subtraction is algebraic, taking into account sign

and all digits of both operands. The

is similar to ADD DECIMAL, except that the sign of the

second operand is changed from positive to negative

or from negative to positive after the operand is ob

tained from storage and before the arithmetic.

The sign of the result is determined by the rules of

algebra. A zero difference is always positive. When

36

high-order digits are lost because of overflow, a zero

result has the sign of the correct difference.

o Difference is zero

1 Difference is less than zero

2 Difference is greater than zero

3

Protection

Addressing

Data

Decimal overflow

Programming Note

The operands of

their low-order bytes coincide, even when their

lengths are unequal. This property may be used to set

to zero an entire field or the low-order part of a

78 11 12 1516

The second operand is placed in the first operand lo

cation.

The operation is equivalent to an addition to zero.

A zero result is positive. When high-order digits are

lost because of overflow, a zero result has the sign of

the second operand.

and digit codes. Extra high-order zeros are supplied

if needed. When the

contain all significant digits of the second operand, a

decimal overflow occurs and results in a program in

terruption, provided that the decimal overflow mask

bit is one. The

overlap when the rightmost byte of the first operand

field is coincident with or to the right of the rightmost

byte of the second operand.

Resulting Condition Code:

o Result is zero

1 Result is less than zero

2 Result is greater than zero

3

Addressing

Data

Decimal overflow

Protection