What is the use of TRT instruction and how it is working?

Answers were Sorted based on User's Feedback



What is the use of TRT instruction and how it is working?..

Answer / senthil kumar m

TRT is used to scan a string of characters, searching
for the occurrence of any the characters which are
specified in a translate table.


TRT also sets the condition code to indicate the results
of the scanning operation as follows:

Condition Code Indications

0 ( Zero ) All function bytes
encountered were X’00’.
1 ( Minus ) A nonzero function byte
was found before the end of operand 1
2 ( Positive ) A nonzero function byte
was found at the end of the operand 1

The condition code can be tested using BZ, BNZ, BM, BNM,
BP, or BNP.

Is This Answer Correct ?    15 Yes 1 No

What is the use of TRT instruction and how it is working?..

Answer / deepalakshmi

IT IS USED TO SCAN STIRING OF CHARACTERS IN THE TABLE, iF
THE FIRST NON ZERO CHARACTER IS ENCOUNTERED IN THE TABLE,
THEN THE SCANING IS STOPPED,THEN THE ADDRESS IS PLACED IN
R1AND THE VALUE IN R2.

THEN THE CONDITION CODE IS SET

Condition Code Indications

0 ( Zero ) All function bytes
encountered were X’00’.
1 ( Minus ) A nonzero function byte
was found before the
end of operand 1
2 ( Positive ) A nonzero function byte
was found at the
end of the operand 1

Is This Answer Correct ?    12 Yes 2 No

What is the use of TRT instruction and how it is working?..

Answer / md saifullah

for example we want to test if given variable is numeric we can do it by following code.

We can define a table with all FF execpt from 0 t0 9 00

Table1 DC 256c'ff'
org table1
dc 10c'00'

Now we can give
TRT var1,table1
BZ numeric

Is This Answer Correct ?    8 Yes 2 No

What is the use of TRT instruction and how it is working?..

Answer / 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

What is the use of TRT instruction and how it is working?..

Answer / karta

TRT is translate and Test. The right operand requires a 256 Byte table.
It is used for scanning the string of characters to check if it has numeric or character or some special symbols.
This instruction affects the content of R1 and R2. before using it, save R1 and R2 content.

Is This Answer Correct ?    1 Yes 0 No

What is the use of TRT instruction and how it is working?..

Answer / sandeep

i wanna learn assembler mainframe from basics can any one
suggest me a good book or some websites.could u plz share
your ideas

Is This Answer Correct ?    1 Yes 1 No

What is the use of TRT instruction and how it is working?..

Answer / guest

TRT instruction is used to translate the contents from one
operand to another then it will test the contents.

Is This Answer Correct ?    5 Yes 13 No

Post New Answer

More Assembler Interview Questions

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

0 Answers  


Write the fetch cycle and execute cycle for following instructions:JMPNZ (jump to the given address if the accumulator not equal to zero) RET(return from a subroutine) ADB (add the contents of register B to the accumulator and save result in the accumulator).

1 Answers  


Explain how to produce soc7 abend?

0 Answers  


Explain the difference in data type "x" and "p"?

0 Answers  


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

0 Answers  






Explain how to access vsam file?

0 Answers  


how to produce SOC7 abend

1 Answers   EDS, IBM,


Explain about base register?

0 Answers  


how to pass the parameters from jcl to assembler pgm?

0 Answers   IBM,


Explain the difference between various read and find statement?

0 Answers  


What is house keeping in assembler? And explain the following code HELLOTSO START 0 * PRINT NOGEN BEGIN SAVE (14,12) LR 12,15 USING TYPE,12 ST 13,SAVE+4 LA 11,SAVE ST 11,8(13) LR 13,11

6 Answers   Mind Tree,


Ap wkur,=p5 where wkur is a label?

0 Answers   IBM,


Categories