Machine Format 90 I E I 1 I 6 050 Assembler Format Op Code R
1
, R
3
, 02 (B2) STM 14,1,X'50'(6)
After the instruction is executed:
Locations 40504053 contain 00 00 25 63
Locations 40544057 contain 00 01 27 36
Locations 4058405B contain 12 43 00 62
Locations 405C405F contain 73 26 12 57
Test Under Mask (TM)
The TEST UNDER MASK instruction examines specific bits
within a byte and sets the condition code according to what
it finds. For example, assume that:
Storage location 9999 contains FB
Register 9 contains 000099 90 Execution of the instruction
Machine Format Op Code '2
91 C3 Assembler Format Op Code 01 (B
1
), '2
TM 9(9) ,X'C3' 009 produces the following result:
FB 1111 1011 2 Mask (C3) 1100 00112 Result llxx XX112 Condition code 3 is set: all selected bits are ones.
I[location 9999 had contained B9, the result would have
been:
B9
Mask (C3)
Result 1011 10012 1100 00112 10xx xx012 Condition code 1 is set: the selected bits are both zeros and
ones.
If location 9999 had contained 3C, the result would have
been:
3C
Mask (C3)
Result 0011 11002 1100 00112 OOxx XX002 Condition code 0 is set; all selected bits are zeros.
Note: Storage location 9999 remains unchanged. Translate (TR)
With the TRANSLATE instruction, System/370 can trans­
late data from any code to any other desired code, provided
that each coded character consists of eight bits or fewer. In
the following example EBCDIC is translated to ASCII. The
first step is to create a 256-byte table in storage locations 1000-10FF. This table contains the characters of the code
into which you are translating (the function bytes). The
table must be in order, not by the binary values of the char­
acters it contains, but by the binary sequence of the charac­ ters of the original code (the argument bytes). For example,
note in the following table that the characters are in the
normal EBCDIC collating sequence.
Translate Table: 100F 1000 1010 1020 - - --- -- -'- 1030 -- -- - - f---- -- - 1040 b + ---1--- ----- I-- ... -- - -- 1050 & $ * - -- -".- -- -- - -- -- .- 1060 / %
- - ,- 1070 #
@
- - -
--- -f.-- 1080 ! b d e !! h
- - - - 1--- - - - --- 1090 j k m n 0 .r: - -- - f--.--- --f-- -- 10AO u v w
x y z .- .-- 10BO --.-- --_.- - - -- ---,-- lOCO A B C D
E F G H , - - - - --- (= 1000 J K L M N 0 P Q R - 10EO S T U
V W X Y Z -
-- 10FO 0 1 2 3 4 5 6 7 8 9 -1-- - 10FF Notes:
1. The underscores are used to indicate the ASCII representations
of the EBCDIC characters shown.
2. I f 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.
Now, assume that starting at storage location 2100 there
is a sequence of 20
1
0 EBCDIC characters to be translated to ASCII: Locations 2100-2113: JOHNbJONESb257bW.b95
Also assume:
Register 12 contains 00 00 21 00 Register 15 contains 00 00 10 00 Appendix I. Number Representation and Instruction-Use Examples 303
As the instruction
Machine Format Op Code L __ __ __ __ oo_0 ____ __ ____ Assembler Format OpCode 0
1
(L,B
1
),02(B
2
)
TR 0(20,12) ,O( 15)
is executed, the binary value of each argument byte is added
to the starting address of the table, and the resulting address
is used to fetch a function byte:
Table starting address: 1000 First argument byte (J): Dl
Address of function byte: lODI
Because the table is arranged so that every EBCDIC char­ acter is replaced by the corresponding ASCII character, the
result is:
Locations 2100-2113: JOHNbJONESb257bW.b95
Note: To verify that this example is correct, find in appen­
dix H the hexadecimal values for the remaining EBCDIC characters and add them to the starting address of the table (1000). The sums should be the addresses within the table
of the corresponding ASCII characters. Translate and Test (TRT)
The TRANSLATE AND TEST instruction is used to scan a
data field {the argument bytes) for characters with a special
meaning. To indicate which characters have special meaning,
first set up a table similar to the one used for the TRANS-
Translate-and-Test Table: 2000 2010 2020 2030 2040 2050 2060 2070 2080 2090 20AO 20BO 20CO 2000 20EO 20FO 00 00 00 00 00 90 80 00 00 00 I-- 00 00 00 00 00 - 00 00 00 00 00 00 00 .. ) 00 00 00 r- 00 00 00 00 00 -- -- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ,_.- .. -- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f-- - 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 _. - 00 00 00 00 c---- --- 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 00 00 00 50 00 00 00 60 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 - 00 00 00 00 r-- -_ .... 00 00 00 00 304 System/370 Principles of Operation 200F 00 00 00 00 00 00 00 00 --- 00 00 00 00 -- 00 00 00 00 --- 10 20 25 00 --
35 40 45 00 --
55 00 00 00 .-- ._-
65 70 75 00 00 00 00 00 00 00 00 00 ._- 00 00 00 00 00 00 00 00 00 00 00 00 r- - ._- 00 00 00 00 -- 00 00 00 00 -- 00 00 00 00 20FF LATE instruction. (See the preceding example.) Once again
the table must be in order by the binary sequence of the
code of the argument bytes. This time, however, put zeros
in the table to indicate characters without any special
meaning and nonzero values to indicate characters with
special meaning.
This example deals with EBCDIC characters; the charac­
ters with special meaning in the argument field are a selected
set of punctuation marks. The Translate-and-Test Table was
set up accordingly.
Note: If the character codes in the statement being trans­
lated occupy a range smaller than 00 through FF 16, a table
of fewer than 256 bytes can be used.
Now, assume that starting at storage location 3000 you
have the following sequence of 30
1
0 EBCDIC characters:
Locations 3000-301D: bbbbbUNPKbbbbbPROUT(9),WORD(5) Also assume:
Register 1 contains 00 00 2F FF
Register 2 contains 00 00 00 00 Register 15 contains 00 00 20 00 As the instruction
Machine Format Op Code L B1 0
1 00 10 I 001 Assembler Format Op Code 0
1
(L, B
1
), O
2
(B2)
TRT 1 (30,1),0(15) 000 is executed, the value of the first argument byte, a blank, is
added to the starting address of the table to produce the ad­ dress of the function byte to be examined:
Table starting address
First argument byte (blank)
Address of function byte 2000 40 2040 Because zeros were originally placed in storage location 2040, no special action occurs, and the operation continues
with the second argument byte. The operation will thus
continue until it reaches the symbol ( (left parenthesis) in
location 3013. When this symbol is reached, its value is
added to the starting address of the table, as usual:
Table starting address
Argument byte (left parenthesis)
Address of function byte 2000 4D 204D Because location 204D contains a nonzero value, the fol­ lowing actions occur:
1. The address of the argument byte, 003013, is placed in
the low-order 24 bits of register 1.
2. The function byte, 20, is placed in the low-order eight
bits of register 2.
3. Condition code 1 is set (scan not completed).
Previous Page Next Page