o 1 234 5 6 7 8 9 ABC D E F 200_ 201_ 202_ 203_ 204_ 205_ 206 207_ 208_ 209_ 20A_ 208_ 20C_ 20D_ 20E_ 20F_ 40 40 40 40 04 14
24 40 40 40 40 40 40 40 40 00 40 40 40 40 40 40 28 40 40 40 40 40 00 00 40 00 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 00 00 00 00 00 00 00 00 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 08 40 OC 10 40 40 40 40 18 lC 20 40 40 40 40 40 2C 40 40 40 40 40 40 40 30 34 38 3C 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 40 00 00 40 40 40 40 40 40 00 00 40 40 40 40 40 40 00 00 40 40 40 40 40 40 00 00 40 40 40 40 40 40 Note: If the character codes in the statement being
translated occupy a range smaller than 00 through
FF{16}, a table of fewer than 256 bytes can be used.
Translate and Test Table
The table entries for the alphameric
characters in EBCDIC are 00; thus, the letter A (code Cl) corresponds to byte location 20Cl, which contains 00. The 15 special symbols have nonzero entries from 04{16} to 3C{16} in incre­
ments of 4. Thus, the blank (code 40) has the entry 04{16}, the period (code
4B) has the entry 08{16}, and so on.
All other table positions have the entry 40{16} to indicate an invalid character.
The table entries are chosen so that
they may be used to select one of a list
of 16 words containing addresses of different routines to be entered for
each special symbol or invalid character
encountered during the scan.
Assume that this list of 16 branch
addresses is stored at locations 3004-3043. Starting at storage location CA80, there
is the following sequence of 21{10} EBCDIC characters, where "b" stands for
a blank.
Locations CA80-CA94: UNPKbPROUT(9),WORD(5) Also assume:
Register 1 contains 00 00 CA 7F.
Register 2 contains 00 00 30 00. Register 15 contains 00 00 20 00. As the instruction:
Machine Format Op Code L Bt Dt B2 D2
DD 14 1 001
1
F 0001 Assembler Format
TRT 1(21,1),0(15) is executed, the value of the first
source byte, the EBCDIC code for the
letter U, is added to the starting
address of the table to produce the
address of the table entry to be exam­
ined:
Appendix A. Number Representation and Instruction-Use Examples A-29
Table starting address
First source byte (U)
Address of table entry 2000 E4 20E4 Because zeros were placed in storage
location 20E4, no special action occurs.
The operation continues with the second
and subsequent source bytes until it
reaches the blank in location CA84. When this symbol is reached, its value
is added to the starting address of the
table, as usual:
Table starting address
Source byte (blank)
Address of table entry 2000 40 2040 Because location 2040 contains a nonzero
value, the following actions occur:
1. The address of the source byte, 00CA84, is placed in the rightmost
24 bits of register 1.
2. The table entry, 04, is placed in
the rightmost eight bits of regis­
ter 2, which now contains 00 00 30 04. 3. Condition code 1 is set (scan not
completed).
The TRANSLATE AND TEST instruction may
be followed by instructions to branch to
the routine at the address found at
location 3004, which corresponds to the
blank character encountered in the scan.
When this routine is completed, program
control may return to the TRANSLATE AND
TEST instruction to continue the scan,
except that the length must first be
adjusted for the characters already
scanned.
For this purpose, the TRANSLATE AND TEST
may be executed by the use of an EXECUTE
instruction, which supplies the length
specification from a general register.
In this way, a complete statement scan
can be performed with a single TRANSLATE
AND TEST instruction used repeatedly by
means of EXECUTE, and without modifying
any instructions in storage. In the
example, after the first execution of
TRANSLATE AND TEST, register 1 contains
the address of the last source byte
translated. It is then a simple matter
to subtract this address from the
address of the last source byte (CA94)
to produce a length specification. This
length minus one is placed in the regis­
ter that is referenced as the R1 field
of the EXECUTE instruction. (Note that
the length code in the machine format is
one less than the total number of bytes
in the field.) The second-operand
address of the EXECUTE instruction
points to the TRANSLATE AND TEST A-30 System/370 Principles of Operation
instruction, which is the same as illus­
trated above, except for the length (l)
which is set to zero.
UNPACK (UNPK)
Assume that storage locations 2501-2502 contain a signed, packed-decimal number
that is to be unpacked and placed in
storage locations 1000-1004. Also
assume:
Register 12 contains 00 00 10 00. Register 13 contains 00 00 25 00. Storage locations 2501-2502 contain 12
3D.
The initial contents of storage
locations 1000-1004 are not signif­
icant.
After the instruction:
Machine Format Op Code
F3 4 1 C 000 I D
Assembler Format Op Code D
t (lt,B t ),D
2
(l2,B
2
)
UNPK 0(5,12),1(2,13)
is executed, the storage locations 1000-1004 contain FO FO F1 F2 D3.
DECIMAL INSTRUCTIONS (See Chapter 8 for a complete descrip­
tion of the decimal instructions.)
ADD DECIMAL (AP)
Assume that the signed, packed-decimal
number at storage locations 500-503 is
to be added to the signed, packed­
decimal number at locations 2000-2002. Also assume:
Register 12 contains 00 00 20 00. Register 13 contains 00 00 05 00. Storage locations 2000-2002 contain 38 46 00 (a negative number>.
Storage locations 500-503 contain 01 12
34 5C (a positive number>.
After the instruction:
Previous Page Next Page