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


Please Help Members By Posting Answers For Below Questions

Explain how to initialize a register to 0000?

585


Explain about base register?

600


What is icm instruction?

637


What is need of start 0?

653


What is house keeping in assembler?

591






What is the use of trt instruction?

580


How is data passed from a calling program to an assembler called program?

629


How are data passed from jcl parm to assembler program?

581


How do you round the addition or subtraction of two numbers in assembler?

602


explain about maximum displacement and how to cross this limit?

697


how to initialize a register to 0000?

663


explain icm instruction?

656


Explain the difference between various read and find statement and which one should be used when for better adabas performance?

579


Explain how to access vsam file?

607


What will happen if we drop the base register in the program which contains only one basereg?

569