to have as many digits as necessary for the comple
tion of the operation.
The operand fields in decimal instructions, other
than EDIT and EDIT AND MARK, should not ov
erlap at all or should have coincident rightmost
bytes. InZERO AND ADD, the field may also over
lap in such a manner that the rightmost byte of the
first operand is to the right of the rightmost byte of
the second operand. For these cases of proper over
lap, the result is obtained as if operands were pro
cessed right to left. Because the code configurations
for digits and signs are verified during the perform
ance ofthe arithmetic, improperly overlapping fields
are recognized as data exceptions. In editing, over
lapping operands yield unpredictable results.
During the execution of a decimal instruction, all
bytes of the operands are not necessarily accessed
concurrently, and the fetch and store accesses to a
single location do not necessarily occur one immedi
ately after the other. Furthermore, for decimal in
structions, intermediate values may be placed in the
result field that may differ from the original operand
and final result values. Thus, an instruction such as
ADD DECIMAL cannot be safely used to update a
shared location in main storage when the possibility
exists that anotherCPU may also be updating that
location.
Number RepresentationPacked dedmal numbers are represented as right
aligned true integers with a plus or minus sign.
Thedigits 0-9 have the binary encoding 0000- 1 001. The codes 1010-1111 are invalid as digit
Name Mnemonic
ADDDECIMAL AP S5 COMPARE DECIMAL CP SS DIVIDE DECIMAL DP SS EDIT ED SS EDIT AND MARK EDMK SS MULTIPLY DECIMAL MP SS SHIFT AND ROUND DECIMAL SRP SS SUBTRACT DECIMAL SP SS ZERO AND ADD ZAP SS Explanation: A Access exceptions
C
Condition code is set
o Data ElxceptionOF Decimal-overflow exception OK Decimal-divide exception
Decimal Instruction Summary
148System/370 Principles of Operation C
C
C
C
C
C
C
codes and are interpreted as sign codes, with1010, 1100, 1110, and 1111 recognized as plus and with 1011 and 1101 recognized as minus. The codes 0000-1001 are invalid as sign codes. A data excep
tion is recognized when an invalid code is detected.
The operation is terminated, except when the sign
position contains an invalid sign code, in which case
the operation is suppressed.
Although alternate encoding of the sign in an
operand is accepted, the preferred sign codes are
always generated for the results of decimal arithme
tic and shifting operations (for the first-operand field
of ADD DECIMAL, DIVIDE DECIMAL,MULTI PLY DECIMAL, SHIFT AND ROUND DECI
MAL, SUBTRACT DECIMAL, andZERO AND
ADD). These codes are plus,1100, and minus, 1101. They are provided even when the operand
value is otherwise unchanged, such as when adding
zero to a number or when shifting the field by a zero
amount. The editing instruction, as well asUN PACK, generates the zone code 1111.
Instructions
The decimal instructions and their mnemonics, for
mats, and operation codes are listed in the following
table. The table also indicates when the condition
code is set and the exceptions in operand designa
tions, data, or results that cause a program interrup
tion.Note: In the detailed descriptions of the individual
instructions, the mnemonic and the symbolic oper
and designation for the IBM System/370 assembly
language are shown with each instruction. For ADD
DECIMAL, for example,AP is the mnemonic and
Characteristics CodePO A 0 OF ST FA PO A 0 F9 PO A SP 0 OK ST FD PO A 0 ST DE PO A 0 R ST OF PO A SP 0 ST FC PO A 0 OF ST FO PO A 0 OF ST FB PO A 0 OF ST Fa PO Decimal feature
R
PERgeneral register alteration event SP Specification exception SS SS instruction format ST PER storage alteration event
tion of the operation.
The operand fields in decimal instructions, other
than EDIT and EDIT AND MARK, should not ov
erlap at all or should have coincident rightmost
bytes. In
lap in such a manner that the rightmost byte of the
first operand is to the right of the rightmost byte of
the second operand. For these cases of proper over
lap, the result is obtained as if operands were pro
cessed right to left. Because the code configurations
for digits and signs are verified during the perform
ance of
are recognized as data exceptions. In editing, over
lapping operands yield unpredictable results.
During the execution of a decimal instruction, all
bytes of the operands are not necessarily accessed
concurrently, and the fetch and store accesses to a
single location do not necessarily occur one immedi
ately after the other. Furthermore, for decimal in
structions, intermediate values may be placed in the
result field that may differ from the original operand
and final result values. Thus, an instruction such as
ADD DECIMAL cannot be safely used to update a
shared location in main storage when the possibility
exists that another
location.
Number Representation
aligned true integers with a plus or minus sign.
The
Name Mnemonic
ADD
C
Condition code is set
o Data Elxception
Decimal Instruction Summary
148
C
C
C
C
C
C
codes and are interpreted as sign codes, with
tion is recognized when an invalid code is detected.
The operation is terminated, except when the sign
position contains an invalid sign code, in which case
the operation is suppressed.
Although alternate encoding of the sign in an
operand is accepted, the preferred sign codes are
always generated for the results of decimal arithme
tic and shifting operations (for the first-operand field
of ADD DECIMAL, DIVIDE DECIMAL,
MAL, SUBTRACT DECIMAL, and
ADD). These codes are plus,
value is otherwise unchanged, such as when adding
zero to a number or when shifting the field by a zero
amount. The editing instruction, as well as
Instructions
The decimal instructions and their mnemonics, for
mats, and operation codes are listed in the following
table. The table also indicates when the condition
code is set and the exceptions in operand designa
tions, data, or results that cause a program interrup
tion.
instructions, the mnemonic and the symbolic oper
and designation for the IBM System/370 assembly
language are shown with each instruction. For ADD
DECIMAL, for example,
Characteristics Code
R
PER