Pattern Byte
Digit selector
Significance starter
Field separator
Message byte
Explanation: Conditions Previous State of
Significance
Indicator Off On Off On * Off On Source Digit 0 1-9
1-9 0-9 0-9 0 0 1-9
1-9 0-9 0-9 ** ** ** Results
state of
Significance
Right Four Indicator at Source Bits End of Digit
Are Plus Code Result Byte Examination * Fill byte Off No Source digittt On Yes Source digittt Off No Source digit On Yes Source digit Off No Fill byte On Yes Fill byte Off No Source digittt On Yes Source digittt Off No Source digit On Yes Source digit Off ** Fill byte Off ** Fill byte Off ** Message byte On * No effect on result byte or on new state of significance indicator. ** Not applicable because source is not examined. tt For EDIT AND MARK only, the address of the rightmost such result byte is placed in general register 1.
Summary of Editing Functions
EDIT AND MARK
EDMK [SS] __ __ I s, I o 8 16 20 32 36 47
The second operand (the source), which
normally contains one or more decimal
numbers in the packed format, is changed
to the zoned format and modified under
the control of the first operand (the
pattern). The address of the first
significant result byte is inserted in
general register 1. The edited result
replaces the pattern.
EDIT AND MARK is identical to EDIT,
except for the additional function of
inserting the address of the result byte
in bit positions 8-31 of general regis­
ter 1 if the result byte is a zoned
source digit and the significance indi­
cator was off before the examination.
Bits 0-7 of the register are not
changed. If no result byte meets the
criteria, general register 1 remains
unchanged; if more than one result byte
meets the criteria, the address of the
rightmost such result byte is inserted. See the figure "Summary of Editing Func­
tions" under EDIT for a summary of the
EDIT and EDIT AND MARK operations.
Resulting Condition Code: o
1
2
3
last field zero or zero length
last field less than zero
last field greater than zero
Program Exceptions:
Access (fetch, operand 2; fetch and
store, operand 1)
Data
Programming Notes
1. Examples of the use of the EDIT AND
MARK instruction are given in Appendix A.
2. EDIT AND MARK facilitates the
programming of floating currency­
symbol insertion. Using appropri­
ate source and pattern data, the
address inserted in general regis­
ter 1 is one greater than the
address where a floating currency­
sign would be inserted. BRANCH ON COUNT (BCTR), with zero in the R2 Chapter 8. Decimal Instructions 8-9
field, may be used to reduce the
inserted address by one.
3. No address is inserted in general
register 1 when the significance
indicator is turned on as a result
of encountering a significance
starter with the corresponding
source digit zero. To ensure that
general register 1 contains a prop­
er address when this occurs, the
address of the pattern byte that
immediately follows the appropriate
significance starter could be
placed in the register beforehand.
4. When multiple fields are edited
with one execution of the EDIT AND
MARK instruction, the address, if any, inserted in general register 1
applies to the rightmost field
edited for which the criteria were
met.
5. See also the programming note under
EDIT regarding performance degrada­
tion due to a possible trial execution. MULTIPLY DECIMAL MP [55]
'Fe' I L. I L. I B. I B. o 8 12 16 20 32 36 47
The product of the first operand (the
multiplicand) and the second operand
(the multiplier) is placed at the
first-operand location. The operands
and result are in the packed format.
The multiplier length cannot exceed 15
digits and sign (L
2
not greater than
seven) and must be less than the multi­
plicand length (l2 less than L
1
); other­
wise, a specification exception is
recognized.
The multiplicand must have at least as
many bytes of leftmost zeros as the
number of bytes in the multiplier;
otherwise, a data exception is recog­
nized. This restriction ensures that no
product overflow occurs.
The multiplicand, multiplier, and prod­
uct are each signed decimal integers in
the packed format and are right-aligned
in their fields. All sign and digit
codes of the multiplicand and multiplier are checked for validity.
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 zeros. 8-10 System/370 Principles of Operation Condition Code:
unchanged.
The code remains Program Exceptions: Access (fetch, operand 2; fetch and store, operand 1) Data Specification
Programming Notes
1. An example of the use of the MULTI­ PLY DECIMAL instruction is given in
Appendix A.
2. The product cannot exceed 31 digits
and sign. The leftmost digit of
the product is always zero.
SHIFT AND ROUND DECIMAL SRP [55] ,---'_F 0_' --1-1 _L _1 -A-I _I _3 -A-I _B _1 lB. o 8 12 16 20 32 36 47
The first operand is shifted in the
direction and for the number of
decimal-digit positions specified by the
second-operand address, and, when shift­
ing to the right is specified, the abso­
lute value of the first operand is
rounded by the rounding digit, 1
3
The
first operand and the result are in the
packed format.
The first operand is considered to be in
the packed-decimal format. Only its
digit portion is shifted; the sign posi­
tion does not participate in the shift­
ing. Zeros are supplied for the vacated
digit positions. The result replaces
the first operand. Nothing is stored
outside of the specified first-operand
location.
The second-operand address, specified by
the B2 and D2 fields, is not used to
address data; bits 26-31 of that address are the shift value, and the leftmost
bits of the address are ignored.
The shift value is a six-bit signed
binary integer, indicating the direction
and the number of decimal-digit posi­
tions to be shifted. Positive shift
values specify shifting to the left.
Negative shift values, which are repres­
ented in two's complement notation,
specify shifting to the right. The
following are examples of the interpre­
tation of shift values:
Previous Page Next Page