The format of the source (the second operand) is
changed from packed to zoned and is modified un­ der control of the pattern (the first operand).
The address of each first significant result charac­ ter is recorded in general register 1. The edited result
replaces the pattern.
The instruction EDIT AND MARK is identical to
EDIT, except for the additional function of inserting
the address of the result character in bit positions
8-31 of general register 1 whenever the result charac­ ter is a zoned source digit and the significance indi­ cator was off before the examination. The use of
general register 1 is implied. The contents of bit po­ sitions 0-7 of the register are not changed.
Resulting Condition Code:
o Last field is zero
1 Last field is less than zero
2 Last field is greater than zero
3 -
Program Exceptions: Operation (if the decimal feature is not installed)
Access (fetch, operand 2; fetch and store, oper­ and 1)
Data
Programming Note
The instruction EDIT AND MARK facilitates the
programming of floating currency-symbol insertion.
The character address inserted in general register 1 is
one more than the address where a floating
currency-sign would be inserted. The instruction
BRANCH ON COUNT (BCTR), with zero in the
R2 field, may be used to reduce the inserted address
byone.
The character address is not stored when signifi­ cance is forced. To ensure that general register 1
contains a valid address when significance is forced,
it is necessary to place into the register beforehand
the address of the pattern character that immediately
follows the significance starter.
Multiply Decimal
The product of the multiplier (the second operand)
and the multiplicand (the first operand) replaces the
multiplicand.
The multiplier size is limited to fifteen 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 L 1, is recognized as a speci­ fication exception. The operation is suppressed, and
a program interruption occurs.
The multiplicand must have at least as many bytes
of high-order zeros as the multiplier field size, in bytes; otherwise, a data exception is recognized, the
operation is terminated, and a program interruption
occurs. This definition of the multiplicand field en­ sures that no product overflow can occur. The maxi­ mum 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
integers, 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
only if their low-order bytes coincide.
Condition Code:
The code remains unchanged.
Program Exceptions: Operation (if the decimal feature is not installed)
Access (fetch, operand 2; fetch and store, oper­ and 1)
Specification
Data
Shift and Round Decimal
The first operand is shifted in the direction and for
the number of digit positions specified by the
second-operand address, and, when shifting to the
right is specified, is rounded by the rounding factor, 13· The second-operand address, specified by the B2
and D2 fields, is not used to address data; its low­ order six bits are the shift value, and the remainder
of the address is ignored.
Second -Operand Address :
o 26
Shift
Value
31
The shift value is a six-bit signed binary integer,
indicating the direction and the number of digit posi­ tions to be shifted. Positive shift values specify
Decimal Instructions 153
shifting to the left. Negative shift values, which are
represented in two's-complement notation, specify
shifting to the right. The following are examples of
the interpretation of shift values:
Shift ValUE! 011111 000001 000000 111111 100000 Amount and Direction
31 digits to the left One digit to the left No shift One digit to the right
32 digits to the right
The Lt, Bl, and Dt fields are interpreted in the
same manner as in the SS format with two length
fields. The result replaces the first operand and is
not stored outside the field specified by the address
and length.
The first operand is considered to be in the:
packed decimal format. Only its digit portion is shift­ the sign position does not participate in the shift­
ing. Zeros are supplied for the vacated digit positions.
For right shift, the contents of the h field, bit
positions 12-15, are used as a rounding factor. The
first operand is rounded by decimally adding the
rounding factor to the leftmost digit to be shifted out
and by propagating the carry, if any, to the left. The
result of this addition is then shifted right. Both the
first operand and the rounding factor are considered
positive quantities for the purpose of this addition.
No overfllow results from the propagation of a carry
since all digits resulting from the addition participate
in the shift. Except for validity checking and the
participation in rounding, the digits shifted out of the
low-order digit position are ignored and are lost.
In the absence of overflow, the sign of a ze:ro
result is made positive. Otherwise, the sign of the I result is the same as the original sign, but the code is
the preferred sign code.
A data exception is recognized when the first
operand have valid sign and digit codes or
when the rounding factor does not have a valid digit
code. Th{! validity of first-operand codes is checked I even when no shift is specified, and the validity of
the roundling factor is checked even when no addi­
tion for rounding takes place. The operation is termi­
nated, exeept when the sign position contains an
invalid sign code, in which case the operation is sup­
pressed.
When one or more significant digits are shifted
out of the high-order digit positions during left shift,
a decimal overflow occurs and results in a program
interruption, provided that the decimal overflow I mask bit its one. Overflow cannot occur on right
shift or when no shifting is specified.
154 System/370 Principles of Operation Resulting Condition Code:
o Result is zero
1 Result is less than zero
2 Result is greater than zero
3 Overflow
Program Exceptions: Operation (if the decimal feature is not installed)
Access (fetch and store, operand 1)
Data
Decimal overflow
Programming Note SHIFT AND ROUND can be used for shifting up to
31 digit positions left and up to 32 digit positions
right. This is sufficient to clear all digits of any deci­
mal field even when rounding in right shift is speci­
fied.
Note that when the B2 field is zero, the six-bit
value, bits 26-31 of the second-operand address, is
obtained directly from bits 42-47 of the instruction.
Subtract Decimal SP Dl (Lt,Bl),D2(L2,B2) [SS] FB L1 L2 I B1 I I B2 I 0 8 12 16 20 32 36 47
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 the
signs and all digits of both operands. The execution
of SUBTRACT DECIMAL is identical to that of
ADD DECIMAL, except that the sign of the second
operand, if negative, is treated as positive, and, if
positive, is treated as negative.
The sign of the difference is determined by the
rules of algebra. When the operation is completed
without an overflow, a zero difference has a positive
sign, but when high-order digits are lost because of
an overflow, a zero difference may be either positive
or negative, as determined by what the sign of the
correct difference would have been.
Resulting Condition Code:
o Difference is zero
1 Difference is less than zero
2 Difference is greater than zero
3 Overflow
Previous Page Next Page