Significance
Indicator Location
Pattern Digit (Before/After) Rule 1000-lOOC b off/off leave(l) bdd,d(d.ddbCR d 0 off/off fill bbd,d(d.ddbCR d 2 off/on(2) digit bb2,d(d.ddbCR 1 on/on leave same
d 5 on/on digit bb2,5(d.ddbCR ( 7 on/on digit bb2,57d.ddbCR d 4 on/on digit bb2,574.ddbCR . on/on leave same
d 2 on/on digit bb2,574.2dbCR d 6+ on/off(3) digit bb2,574.26bCR b off/off fill same C off/off fill bb2,574.26bbR
R off/off fill bb2,574.26bbb
Notes:
1. This character is the fill byte.
2. First nonzero decimal source digit turns on significance
indicator. 3. Plus sign in the four rightmost bits of the byte turns
off significance indicator.
Thus, after the instruction is executed,
the pattern field contains the result as
follows:
Pattern 1000 100C 140140lF216BIF51F71F414BIF21F61401401401 b b 2 574 2 6 b b b
This pattern field prints as:
2,574.26
The source field remains unchanged. Condition code 2 is set because the
number was greater than zero.
If the number in the source field is
changed to the negative number 00 00 02 6D and the original pattern is used, the
edited result this time is:
Pattern 1000 100C 140140140140140140lFol4BlF21F6140lC31D91 b b b b b b 0 2 6 b C R
This pattern field prints as: 0.26 CR The significance starter forces the
significance indicator to the on state
and hence causes a leading zero and the
decimal point to be preserved. Because
the minus-sign code has no effect on the
significance indicator, the characters CR are printed to show a negative (cred­
it) amount. Condition code 1 is set (number less
than zero).
EDIT AND MARK (EDMK)
The EDIT AND MARK instruction may be
used, in addition to the functions of
EDIT, to insert a currency symbol, such
as a dollar sign, at the appropriate
position in the edited result. Assume
the same source in storage locations 1200-1203, the same pattern in locations 1000-100C, and the same contents of
general register 12 as for the EDIT
instruction above. The previous
contents of general register 1 (GR1) are
not significant; a LOAD ADDRESS instruc­
tion is used to set up the first digit
position that is forced to print if no
significant digits occur to the left.
The instructions:
LA 1,6(0,12) Load address of
forced significant
digit into GR1
EDMK 0(13,12),X'200'(12) leave address
of first signif­
icant digit in GR1 BCTR 1,0 Subtract 1 from
address in GRl
MVI O(l),C'$' Store dollar sign
at address in GR1
produce the following results for the
two examples under EDIT:
Appendix A. Number Representation and Instruction-Use Examples A-33
Pattern 1000 100e 140lSBIF216BIFsIF71F414BIF21F61401401401 b $ 2 S 7 4 2 6 b b b This pattern field prints as:
$2,S74.26 Condition code 2 is set to indicate that
the number edited was greater than zero.
Pattern 1000 lOOC 140140\40\40\40ISB\FoI4BIF2IF6140IC3ID91 b b b b b $ 0 2 6 b C R This pattern field prints as: $0.26 CR Condition code 1 is set because the
number is less than zero.
MULTIPLY DECIMAL (MP)
Assume that the signed, packed-decimal
number in storage locations 1202-1204 (the multiplicand) is to be multiplied
by the signed, packed-decimal number in
locations SOO-SOl (the multiplier). 1202 1204 Multiplicand \3814610DI SOO SOl Multiplier The multiplicand must first be extended
to have at least two bytes of leftmost
zeros, corresponding to the multiplier
length, so as to avoid a data exception
during the multiplication. ZERO AND ADD
can be used to move the multiplicand
into a longer field. Assume:
Register 4 contains 00 00 12 00. Register 6 contains 00 00 OS 00. Then execution of the instruction: ZAP X'100'(S,4),2(3,4) sets up a new multiplicand in storage
locations 1300-1304: 1300 1304 Multiplicand (new) 100100138\4610DI A-34 System/370 Principles of Operation Now, after the instruction:
Machine Format Op Code L t L2 Bt Dt FC 4 1 4 100
1
Assembler Format Op Code Dt(Lt,Bt),D2(L2,B2) MP X'100'(S,4),O(2,6) B2 D2
6 0001 is executed, storage locations 1300-1304 contain the product: 01 23 45 66 OC. SHIFT AND ROUND DECIMAL (SRP) The SHIFT AND ROUND DECIMAL (SRP) instruction can be used for shifting
decimal numbers in storage to the left
or right. When a number is shifted
right, rounding can also be done.
Decimal Left Shift
In this example, the contents of storage
location FIELDl are shifted three places
to the left, effectively multiplying the
contents of FIELDl by 1000. FIELD! is
six bytes long. The following instruc­
tion performs the operation:
Machine Format Op Code L! FO 5
Assembler Format SRP FIELD!(6),3,0 FIELD! (before): 00 01 23 4S 67 8C FIELD1 (after): 12 34 S6 78 00 OC The second-operand address in this
instruction specifies the shift amount
(three places). The rounding digit, 1
3
, is not used in a left shift, but it must
be a valid decimal digit. After
execution, condition code 2 is set to
show that the result is greater than
zero.
Previous Page Next Page