It seems that the TRE instruction has been in z/Arch for at least a few
years. If anyone is inclined to try this, it would be interesting to see
how it fares against Ed Jaffe's code:
XR R1,R1 Clear for insert
L R15,Length Load string length
Loop IC R1,Input-1(R15) Get input byte
IC R0,XlatTab(R1) Get translated character ...
STC R0,Output-1(R15) ... and store it in output
BCT R15,Loop Decrement length & loop until done
I believe the OP said that the data to be translated had to first be moved
from one buffer to another. The above does that, but a move of some type
needs to be added to Ed's code to make it a true comparison.
--Art C.
At 03:42 PM 3/24/2008, Edward Jaffe wrote:
>McKown, John wrote:
>>I don't think you have a choice, in the general case. That is because
>>all the new TRxx type instructions seem to terminate when the data in
>>your buffer equals to the contents of the low order byte general
>>register 0. I.e. they stop at an "end of buffer" type character, like a
>><null> in a C string. If you can tolerate this behaviour, then I'd look
>>at the TRE or TROO instruction. The TRE seems easier to use, to me.
>>
>
>The following fragment should work if you prefer looping TRE over traditional
>TR. TRE requires you to manually translate the so-called "stop" character with
>an MVC. But, at least there's no EXecute for the final segment.
>
> LM R14,R15,xxxxxx Load string ptr and its length
> LA R1,xxxxxx Ptr to translation table
> XR R0,R0 Set stop char = x'00'
> DO INF Do for translate
> TRE R14,R1 Translate the string
> DOEXIT Z Exit if no more data
> IF O If iterate needed
> ITERATE , Process another segment
> ENDIF , EndIf
> MVC 0(1,R14),0(R1) Translate x'00' to whatever
> LA R14,1(,R14) Advance past stop character
> AHI R15,-1 Decrement length remaining
> DOEXIT NP Exit if no more data
> ENDDO , EndDo for translate
==================================================
Art Celestini Celestini Development Services
Phone: 201-670-1674 Wyckoff, NJ
============= http://celestini.com =============
Mail sent to the "From" address used in this post
will be rejected by our server. Please send off-
list email to: ibmmain<at-sign>celestini<dot>com.
==================================================
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html