What is the use of TRT instruction and how it is working?
Answer Posted / phils
TRT is used to scan a string of characters byte by byte,
using the hexadecimal value of each character to 'index'
into a 256 byte translate table, If the resultant table byte
is set to X'00', then processing continues with the next
input character, and so on until end of input string, or a
non-zero table byte is encountered.
TRT sets the condition code to indicate the results
of the scanning operation as follows:
Condition Code Indications
0 ( Zero ) All table bytes X’00’.
1 ( Minus ) nonzero tabl found before the end
of operand 1
2 ( Positive ) A nonzero table byte was found at
the end of the operand 1
The condition code can be tested using BZ, BNZ, BM, BNM,
BP, or BNP.
In this way we can test that a string contains only
'desirable values' by setting the equivalent bytes in the
translate table to X'00' e.g. testing for numerics as in
answer 4.
Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Explain how to initialize a register to 0000?
Explain about base register?
What is icm instruction?
What is need of start 0?
What is house keeping in assembler?
What is the use of trt instruction?
How is data passed from a calling program to an assembler called program?
How are data passed from jcl parm to assembler program?
How do you round the addition or subtraction of two numbers in assembler?
explain about maximum displacement and how to cross this limit?
how to initialize a register to 0000?
explain icm instruction?
Explain the difference between various read and find statement and which one should be used when for better adabas performance?
Explain how to access vsam file?
What will happen if we drop the base register in the program which contains only one basereg?