View previous topic :: View next topic
|
Author |
Message |
kalpana
New User
Joined: 19 Nov 2004 Posts: 24 Location: Banglore
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
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 |
|
|
kalpana
New User
Joined: 19 Nov 2004 Posts: 24 Location: Banglore
|
|
|
|
Thanks a lot umeysan. |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
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'
|
|
Back to top |
|
|
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Hint: 240 = 15 times 16 = F0 in hexadecimal. |
|
Back to top |
|
|
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
Robert Really great Hint and great way of TR.
I know we can learn these tricks by working(and getting older ) 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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
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 |
|
Back to top |
|
|
jepson
New User
Joined: 24 Oct 2008 Posts: 7 Location: India
|
|
|
|
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 .. , nd this one looks interesting. |
|
Back to top |
|
|
Harsh Pawar
New User
Joined: 04 Jun 2008 Posts: 25 Location: Noida
|
|
|
|
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 |
|
|
jepson
New User
Joined: 24 Oct 2008 Posts: 7 Location: India
|
|
|
|
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 |
|
|
|