Edit and Edit and Mark
The following examples show the step-by-step editing
of a packed field with a length specification of four
against a pattern 13 bytes long. The following symbols
are used: SYMDOL b
(
)
d
Assume:
MEANING
blank character
significance start character field separator character
digit-select character
Loc 1000-1012 (first operand)
Loc 120-1203 (second operand)
Reg 120 bdd,dd ( .ddbCR 02 57 42 6+ 00 00 10 00 The instruction is: OpCode D. and provides the following:
PATTERN DIGIT S TRIGGER RULE LOCATION 1000-1012 b o leave(l)bdd, dd(. ddbCR d 0 o fill hhd, dd(. ddbCR d 2 1 digit bh2, dd(. ddbCR(2) 1 leave same
1 digit bh2, 5d(. ddbCR d 5
d 7 1 digit bb2, 57 (. ddbCR ( 4 1 digit bh2, 574. ddbCR 1 leave same
d 2 1 digit bb2, 574. 2bdCR d 6+ o digit bb2, 574. 26bCR (3)
b o fill same C o fill bh2, 574, 26bbR
R o fill bb2,574,26bbb
Thus:
Loc 1000-1012 (after) bb2,574.26bCR NOTES 1. This character is saved as the fill character.
2. First nonzero digit sets S trigger to 1.
3. Plus sign in this same byte sets S trigger to zero.
Condition code = 2; result greater than zero.
If the second operand in location 1200-1203 is 00 00 02 6-, the following results are obtained:
Loc 1000-1012 (before) hdd, dd(. ddbCR Loc 1000-1012 (after) bbbbbbb. 26hCR Condition code = 1; result less than zero.
In this case the significance-start character in the
pattern causes the decimal point to be left unchanged.
The minus sign does not reset the S trigger so that
the cn symbol is also preserved.
In the edit examples above, if the initial character
of the pattern was an asterisk, then asterisk-protec­
tion would be achieved.
In the same example, if EDIT AND MARK was used:
Reg 1 (before) 00 12 34 56
Reg 1 (after) 00 00 10 02 Branch On Condition Assume a prior operation has been perfonned which
resulted in setting the condition code in the psw. The
program is to branch if the result of the previous
operation is nonzero.
The BRANCH ON CONDITION with a mask of 0111 == 7 10 in the Ml field becomes a branch-on-nonzero
instruction.
Reg 5 00000100 Reg 12 00040000 The instruction is: Op Code Ml X2 B2 D, Be 7 5 12 100 and causes a branch to location 40,200, provided the condition
code is not zero. Condition code setting is unchanged.
Execute
The ADD instruction at location 350 is to be executed
by means of EXECUTE:
Assume:
Reg 3
Reg 12
Loc 350 The instruction is: Op Code
EX o
X 2
3 00 00 00 10 00 00 03 30 AR 4,6
12
D2 10 The CPU executes the ADD instruction and takes the
next sequential instruction after EXECUTE. The move character instruction MVC at location 1200 is to be executed, and the number of characters to be
moved is computed in register 5.
Assume:
Reg 5 (rightmost 8 bits)
Reg 7
Reg 13
Loc 1200 Length field (8 bits) =
The instruction is: Op Code Rl X 2 EX 5 7 01110000 = 11210 00 00 00 50 00 00 10 50 MVC 0, 15, 100, 12, 1000 00000000 B2
13 100 The rightmost eight bits of R5 arc OR' cd with the
length portion (positions 8-15) of the instruction being
executed, at location 1200 prior to execution of MOVE. However, the actual instruction at location 1200 re-
Appendix A 127
mains unchanged, and the instruction actually exe-
uted by EXECUTE is Op Code B, 0, B. D. I MvclIT 112 1151 100 100 to provide a move with a length of 112 bytes and thus
move 113 bytes.
Assembly Language Examples
These programming examples use the System/360 as­
sembly-language format and mnemonics. In general,
the operands are shown symbolically with indexing or
length specification following the symbol and enclosed
in parentheses. Lengths are given as the total number
of bytes in the field. This differs from the machine
definition regarding lengths which states that the
length is the number of bytes to be added to the field
address to obtain the address of the last byte of the
field. Thus the machine length is one less than the
assembly-language length. The assembly language
automatically subtracts one from the length specified
when the instruction is assembled.
Examples
l. Decimal right shift -even number of places.
Assume symbolic location "Source" is: Source: 12 34 56 78 9S and we wish to drop two places. MOVE NUMERICS (MVN) can be used to accomplish this Source MVN Source + 3 (1), Source + 4 12 34 56 7S 9S a length of 4 instead of 5 in operations using sym­
bohc locatIOn Source, the result is accomplished.
2. Decimal right shift -odd number of places. Source: 12 34 56 78 9S Assume we wish to drop three places.
The move with offset (MVO) instmction is used. Source MVO Source (5), Source (3) 00 01 23 45 6S 3. Decimal left shift -even number of places.
Assume tbe following at symbolic location "ZERO." Zero: 00 00 Source: 12 34 56 78 9S A left shift of four places can be performed as follows: Source MVC Source + 5 (2), Zero 12 34 56 78 9S 00 00 MVN Source + 6 (1), Source + 4 12 34 56 78 9S 00 OS NI Source + 4,240 12 3456 78 90 00 OS . Note the number 24010 in the AND IMMEDIATE instmction pro­
VIdes a mask of 11110000 which is to be used to make the old
sign positions zero.
128
4. Decimal left shift -odd number of places. Zero: 00 00 Source: 12 34 56 78 9S Assume the shift to be three places. Source MVC Souree + 5 (2), Zero MVN Source + 6 (1), Source + 4
NI Souree + 4, 240 MVO Source (6), Source (5)
12 34 56 78 9S 00 00 12 34 56 78 9S 00 OS 12 34 56 78 90 00 OS 01 23 45 67 89 00 OS 5. A master inventory file is to be updated by issue
and receipt transactions. There may be multiple trans­
actions pertaining to a master record. Both inactive
and updated master records are to be rewritten. The
following calculations are performed to update the
master:
Receipts
l. Receipt quantity X unit cost == receipt cost
2. Receipt cost + total cost == new total cost
3. Receipt quantity + quantity on hand new
quantity
4. New total cost --;- new quantity == new average
unit cost
Issues
l. Quantity on hand -issue quantity == new quantity
(if quantity on hand is less than issue quantity, go
to an exception routine) .
2. Issue quantity X average unit cost == issue cost
3. Total cost -issue cost == new total cost
4. If new quantity is not greater than the reorder level,
go to an exception routine. > Record Description NI aster Record:
Item #: 6 alphameric characters
Description: 20 alphabetic characters
Quantity: 7 digits plus sign
Total cost: 11 digits plus sign (2 decimal places)
Average unit cost: 7 digits plus sign (3 decimal places)
Reorder level: 5 digits plus sign
Transaction Record:
Type code: 1 digit plus sign
(plus 1 == receipt)
( plus 2 == issue)
Item #: 6 alphameric characters
Quantity: 5 digits plus sign
Receipt unit cost: 6 digits plus sign (2 decimal places)
Previous Page Next Page