Yeah  - mea culpa. It's been years since I looked at that code. We escaped our 
search strings and then looked for the opening character.
You might still do better to do an SRST / CLC loop.


On 3/15/18, 11:04 AM, "IBM Mainframe Assembler List on behalf of Charles 
Mills" <ASSEMBLER-LIST@LISTSERV.UGA.EDU on behalf of charl...@mcn.org> wrote:

    Nothing, so far as I know. :-)
    
    But it finds only a single character and not a substring in a string; a 
needle in a haystack, to use the Rexx idiom.
    
    For finding a single character in a string, SRST is almost undoubtedly 
faster than TRT. For finding either of two characters, hard to say, but I am 
going to guess SRST is still faster.
    
    Charles
    
    
    -----Original Message-----
    From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] 
On Behalf Of Alan Atkinson
    Sent: Thursday, March 15, 2018 7:32 AM
    To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
    Subject: Re: Two string instruction questions
    
    Am I missing something? What's wrong with SRST?
    
    
    On 3/15/18, 10:28 AM, "IBM Mainframe Assembler List on behalf of Charles 
Mills" <ASSEMBLER-LIST@LISTSERV.UGA.EDU on behalf of charl...@mcn.org> wrote:
    
        Traditional, but not anywhere near optimally quick.
        
        1. Read the Wikipedia article @Gil linked to. There are faster ways 
than the
        obvious way.
        
        2. TRT is a single op code but that does not make it "fast." Picture an
        assembler loop to do what TRT does. Not very fast, right? Now picture 
the
        same loop in millicode. Still not very fast. That's TRT. Millicode is 
not
        magic; it's more or less machine code running under the covers. SRST is
        probably considerably faster (although still not magically fast, and not
        case-insensitive as TRT potentially is). On the other hand, "it 
depends";
        and cache misses are what is slow -- instructions themselves hardly 
matter.
        
        Charles
        
        
        -----Original Message-----
        From: IBM Mainframe Assembler List 
[mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU]
        On Behalf Of Robin Vowels
        Sent: Wednesday, March 14, 2018 7:32 PM
        To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
        Subject: Re: Two string instruction questions
        
        From: "Charles Mills" <charl...@mcn.org>
        Sent: Thursday, March 15, 2018 2:51 AM
        
        
        > 1.       Is there a machine instruction that will find one string 
within
        > another? That given "Now is the time" and "is" would find the "is" 
and 
        > return a pointer to it? A machine instruction analog of Rexx POS?
        > 
        > 2.       Searching the PoOp for such an instruction led me to CUSE. It
        does
        > not seem that CUSE could be used for this - is that correct? If I am 
        > reading CUSE correctly, then given "Now is the time", "All is well" 
        > and 2 or 3 would return the position of "is". Is my reading correct? 
        > What would that be good for? What would be a reasonable real-world 
use?
        
        The traditional TRT to search for the first letter, followed by CLC for 
the
        word (for which the search can commence at the second letter, because 
the
        first letter has already been found), will likely be the quickest.
        
        ---
        This email has been checked for viruses by Avast antivirus software.
        https://www.avast.com/antivirus
        
    

Reply via email to