er_neo
New User
Joined: 10 Jan 2006 Posts: 18 Location: Indore
|
|
|
|
Can anyone help me out in understanding how the command TRT actually works.
Explaination with example will be more than welcome.
Actually i am trying to understand following set of command :
PHCODEIT EX REG4,SCAN
.
.
.
.
SCAN TRT 0(,REG1),0(REG5)
thanks a ton in advance |
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
7.5.100 TRANSLATE AND TEST
TRT D1(L,B1),D2(B2) [SS]
The bytes of the first operand are used as eight-bit arguments to select
function bytes from a list designated by the second-operand address. The
first nonzero function byte is inserted in general register 2, and the
related argument address in general register 1.
The L field specifies the length of only the first operand.
The bytes of the first operand are selected one by one for translation, proceeding from left to right. The first operand remains unchanged in storage. Calculation of the address of the function byte is performed as in the TRANSLATE instruction. The function byte retrieved from the list is inspected for a value of zero.
When the function byte is zero, the operation proceeds with the next byte of the first operand. When the first-operand field is exhausted before a nonzero function byte is encountered, the operation is completed by setting condition code 0. The contents of general registers 1 and 2 remain unchanged.
When the function byte is nonzero, the operation is completed by inserting the function byte in general register 2 and the related argument address in general register 1. This address points to the argument byte last translated. The function byte replaces bits 24-31 of general register 2, and bits 0-23 of this register remain unchanged. In the 24-bit addressing mode, the address replaces bits 8-31 of general register 1, and bits 0-7 of this register remain unchanged. In the 31-bit addressing mode, the address replaces bits 1-31 of general register 1, and bit 0 of this register is set to zero.
When the function byte is nonzero, either condition code 1 or 2 is set, depending on whether the argument byte is the rightmost byte of the first operand. Condition code 1 is set if one or more argument bytes remain to be translated. Condition code 2 is set if no more argument bytes remain.
The contents of access register 1 always remain unchanged.
Access exceptions are recognized only for those bytes in the second operand which are actually required. Access exceptions are not recognized for those bytes in the first operand which are to the right of the first byte for which a nonzero function byte is obtained.
Resulting Condition Code:
0
All function bytes zero
1
Nonzero function byte; first-operand field not exhausted
2
Nonzero function byte; first-operand field exhausted
3
--
Program Exceptions:
* Access (fetch, operands 1 and 2)
Programming Notes:
1. An example of the use of the TRANSLATE AND TEST instruction is given in Appendix A, "Number Representation and Instruction-Use Examples."
2. TRANSLATE AND TEST may be used to scan the first operand for characters with special meaning. The second operand, or list, is set up with all-zero function bytes for those characters to be skipped over and with nonzero function bytes for the characters to be detected. |
taken from
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR006/7.5.100?SHELF=HAS1BK40&DT=19990630131355 |
|