IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Difference b/n TR and TRT


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kalpana

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Tue Jul 29, 2008 2:31 pm
Reply with quote

Hi all,
Could any one please let me know the answers for the below queries?


1) What is the difference b/n TR and TRT insturctions ( please provide me with sample code)

2) what is EX instruction -( I know u can modify the length factor at run time using EX)?


3) I have created a file using DCB instructions in JCL ddname i have given a PDS and assembler program in DCB parameter DSORG= PS

Here which one will override PS/PDS?

4) How to suppress leading zeros using edit instruction
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 29, 2008 4:18 pm
Reply with quote

Hi !

EX-Command in own words:

Jump to a label, do that command there, using the length in a specified register, and return back.

L R5, FromField
L R2, ToField

IC R1,LENGTH ...insert length in R1
EX R1,Move§§Field ...jump to the instruktion

Move§§Field MVC 0(*-*,R2),0(R5)
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 29, 2008 4:26 pm
Reply with quote

Hi !

4.) How to suppress leading zeros using edit instruction

Using the right EDIT-MASK. Hex-20 will supress leading zeroes.
Hex-21 is used to make clear, whrere the first leading zero ist not to be supressed, means printed.

Field = 00012
Mask = 402020216B2020
Result = 0,12
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 29, 2008 4:30 pm
Reply with quote

Hi !

3.) Jcl will override the program-definition. The definition in the programm is PS for a sequential File. In the jcl you only assign a member of PDS to this seq.-file.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Tue Jul 29, 2008 4:37 pm
Reply with quote

Hi !

1.) TR = Translate & TRT = Translate and Test.

TR = Translate operand-1 with corresponding sign in a table, adressed by operand-2.

TRT = Translate and Test operand-1 with corresponding sign in a table, adressed by operand-2.

Most significant difference: With TRT, the first operand is not changed, only tested. For more informations plse look at the manuals or use IBM-Bookmanager.
Back to top
View user's profile Send private message
kalpana

New User


Joined: 19 Nov 2004
Posts: 24
Location: Banglore

PostPosted: Tue Jul 29, 2008 4:44 pm
Reply with quote

Thanks a lot umeysan.
Back to top
View user's profile Send private message
bengtpelle

New User


Joined: 28 Aug 2006
Posts: 24
Location: St. Petersburg, FL

PostPosted: Mon Aug 11, 2008 5:41 am
Reply with quote

A common use of the TR instruction will illustrate its use.
This example can be used to print data in Hex format.

INPUT DC X'123ABC'
DUMMY1 DC C' '
OUTPUT DC CL6' '
DUMMY DC C' '
TRVALUE DC C'0123456789ABCDEF'

UNPK OUTPUT(7),INPUT(4) OUTPUT = 'F1F2F3FAFBFC'
TR OUTPUT,TRVALUE-240 OUTPUT = 'F1F2F3C1C2C3'

icon_lol.gif
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Wed Jul 22, 2009 5:31 pm
Reply with quote

I know i am replying to an old post but i am curious to know,

what TRVALUE-240 will do in above case.what is the significance of 240 here ?

Also we say TRT ( Translate and Test ) but does this instruction really translate something or it just test ?


Regards,
Harsh.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 22, 2009 6:53 pm
Reply with quote

240 indicates that the Assembler subtract 240 from the current location counter and perform the TR.

However, if the current location counter is less than 240, then you could issue -

Code:

MVZ OUTPUT,=XL6'00' CLEAR ALL ZONES (NUMERICS REMAIN)
TR  OUTPUT,TRVALUE  TRANSLATE TO DISPLAYABLE

The above technique will always work, but it's up to you to use it or use TRVALUE-240 instead.

You will get an Assembly error if TRVALUE-240 is not addressable.

Regards,
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jul 22, 2009 7:18 pm
Reply with quote

Hint: 240 = 15 times 16 = F0 in hexadecimal.
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Wed Jul 22, 2009 11:05 pm
Reply with quote

Robert Really great Hint and great way of TR.
I know we can learn these tricks by working(and getting older icon_biggrin.gif ) but is there any place (or link) where i can find some more TR examples like the one above.


we say TRT ( Translate and Test ) but does this instruction really translate something or it just tests ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jul 22, 2009 11:31 pm
Reply with quote

From the POP on TR:
Quote:
The bytes of the first operand are used as eight-bit arguments to
reference a list designated by the second-operand address. Each function
byte selected from the list replaces the corresponding argument in the
first operand.
From the POP on TRT:
Quote:
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.
TRT does not talk about replacement like the TR.
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Thu Jul 23, 2009 10:04 am
Reply with quote

Just a note for anyone trying the UNPK/TR technique above -- the offset of the TRVALUE variable has to be >= x'F0' so this trick sometimes causes assembler errors in very small modules. I ran into that years ago when trying to make a CSECT that did only this icon_rolleyes.gif
Back to top
View user's profile Send private message
jepson

New User


Joined: 24 Oct 2008
Posts: 7
Location: India

PostPosted: Tue May 24, 2011 11:39 pm
Reply with quote

Can someone please explain this TR example -

I think i understood the 240 part - that is(i think) to make F1 to point to start of TRVALUE. but, How did the final value of OUTPUT get = 'F1F2F3C1C2C3'
C1C2C3 .. ??

I've understood few other example's of TR, but this one .. icon_sad.gif , nd this one looks interesting.
Back to top
View user's profile Send private message
Harsh Pawar

New User


Joined: 04 Jun 2008
Posts: 25
Location: Noida

PostPosted: Wed May 25, 2011 10:22 am
Reply with quote

You replied to a 2 year old post. Anyways , let me make the table to clarify it:

.
.
.
.
.
. values above TRVALUE can be anything. So If you write TRVALUE-240 then logic does not care about values before/above TRVALUE. It could be anything as long as Operand1 ( that is OUTPUT in or case) is strictly between F0 and FF . Other wise result is unpredictable.
.

TRVALUE DC C'0123456789ABCDEF'
F0 ...... F0
F1 ...... F1
F2 ...... F2
F3 ...... F3
F4 ...... F4
F5 ...... F5
F6 ...... F6
F7 ...... F7
F8 ...... F8
F9 ...... F9
FA ...... C1
FB ...... C2
FC ...... C3
FD ...... C4
FE ...... C5
FF ...... C6

Now when you have OUTPUT = 'F1F2F3FAFBFC' , TR would translate (convert) F1 to F1. F2 to F2 ........ FA to C1. FB to C2. FC to C3 .....
So final OUTPUT = 'F1F2F3C1C2C3'.

Regards,
Harry
Back to top
View user's profile Send private message
jepson

New User


Joined: 24 Oct 2008
Posts: 7
Location: India

PostPosted: Wed May 25, 2011 10:45 am
Reply with quote

ahhh, rt . all the time i was thinking A = FA then how come C1 .. my fault.

Now i get it , thanks a lot for the reply.

( yeah, i know its was a old post but i could n't get to the answer so thought i better ask ...thank you . )
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Timestamp difference and its average ... DB2 11
No new posts Difference when accessing dataset in ... JCL & VSAM 7
No new posts What is the difference between Taskty... Compuware & Other Tools 2
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Difference between CEE3250C and CEE3204S COBOL Programming 2
Search our Forums:

Back to Top