John, Because of the nature of TRT, TRTE and TRTRE a single byte CLI loop can be faster to much faster, or at least they have been in the past. I don't think they have changed the underlying hardware process in the EC12, but I have been wrong in the past. I once read that if you were looking for up to 3 different characters in a string, the open code method will beat any of those three instructions.
The problem with TRT is it validates the whole TRT table before it starts to do the TRT. I believe TRTE and TRTRE also suffer from that, but also they are milli-coded, or is it micro-coded, which incurs a non-trivial amount of instruction startup and termination time. The overheads are similar to MVCL compared to MVC used in a loop. A loop of MVC's will reduce the CPU time of a routine until you get to close to moving 32K at a time. If you are moving more than 32K at a time, then MVCL can win. As you say, the single CLI loop is ugly, but it can be much faster. I am writing code right now that uses the TRT and TRTRE instructions, but that is for exception error processing, not record level or sub-record level processing so speed was not my primary concern. Chris Blaicher Principal Software Engineer, Software Development Syncsort Incorporated 50 Tice Boulevard, Woodcliff Lake, NJ 07677 P: 201-930-8260 | M: 512-627-3803 E: [email protected] -----Original Message----- From: IBM Mainframe Assembler List [mailto:[email protected]] On Behalf Of John Gilmore Sent: Thursday, May 15, 2014 2:32 PM To: MVS List Server 2 Subject: Re: Right Justification Subroutine If your routine is to be used heavily there is a much faster way to do left justifications. It is to use a TRTE with a 256-byte table that defines only a blank, x'40', as a licit character. This approach yields the zero-origin offset of the leftmost non-blank directly. If I were writing such a routine, as I did long ago, I would also give it an additional entry point for right justification, which can [now] be accomplished using the same approach [and the same table] but using a TRTRE instead of a TRTE. I agree 'philosophically' with most of what Bill wrote; but single-character-by-single-character operations on strings are, I think, not just tedious but ugly where better approaches are available. John Gilmore, Ashland, MA 01721 - USA
