Discussion:
SRST Question
(too old to reply)
Grinsell, Don
2018-01-05 21:10:29 UTC
Permalink
Raw Message
Has anybody played with the SRST instruction? I am confused by the examples in the PoP. Why do they branch back to the SRST instruction when the string is found, e.g. BC 1,LOOP1? Shouldn't the branch be to the FOUND label, e.g. BC 1,FOUND?

L 5,STRAADR
L 4,STRALEN
AR 4,5
LA 0,X'C1'
LOOP1 SRST 4,5
BC 1,LOOP1
BC 2,NOTFND
FOUND [Any instruction]
...
NOTFND [Any instruction]

--

Donald Grinsell, Systems Programmer
Enterprise Technology Services Bureau
SITSD/Montana Department of Administration
406.444.2983 (D)


"When a stupid man is doing something he is ashamed of, he always declares that it is his duty."
~ George Bernard Shaw (1856-1950)

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Tony Harminc
2018-01-05 21:23:26 UTC
Permalink
Raw Message
Post by Grinsell, Don
Has anybody played with the SRST instruction?
Yes - I use it all the time.
Post by Grinsell, Don
I am confused by the examples in the PoP. Why do they branch back to the SRST instruction when the string is found, e.g. BC 1,LOOP1? Shouldn't the
branch be to the FOUND label, e.g. BC 1,FOUND?
L 5,STRAADR
L 4,STRALEN
AR 4,5
LA 0,X'C1'
LOOP1 SRST 4,5
BC 1,LOOP1
BC 2,NOTFND
FOUND [Any instruction]
...
NOTFND [Any instruction]
--
Keep in mind that the number on the BC is not the expected value of
the condition code. BC 1 means branch if the CC is 3. SRST sets CC 3
if the CPU decides to stop the instruction before it's completed the
search. BC 2 *does* mean branch if CC=2, but that's just the way the
mask maps to the CC values. If you want to branch on character found
(CC=1), you'd use BC 4. In this code that's the fall-through.

Tony H.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Grinsell, Don
2018-01-05 22:15:00 UTC
Permalink
Raw Message
DOH! Thanks for clarifying that. I'm obviously a little out of practice with my assembler.

Regards and happy Friday to all.

--

Donald Grinsell, Systems Programmer
Enterprise Technology Services Bureau
SITSD/Montana Department of Administration
406.444.2983 (D)


"This is a war of the unknown warriors; but let all strive without failing in faith or duty..."
~ Winston Churchill
Post by Charles Mills
-----Original Message-----
Behalf Of Tony Harminc
Sent: Friday, January 05, 2018 2:25 PM
Subject: Re: SRST Question
Post by Grinsell, Don
Has anybody played with the SRST instruction?
Yes - I use it all the time.
Post by Grinsell, Don
I am confused by the examples in the PoP. Why do they branch back to
the SRST instruction when the string is found, e.g. BC 1,LOOP1? Shouldn't
the branch be to the FOUND label, e.g. BC 1,FOUND?
Post by Grinsell, Don
L 5,STRAADR
L 4,STRALEN
AR 4,5
LA 0,X'C1'
LOOP1 SRST 4,5
BC 1,LOOP1
BC 2,NOTFND
FOUND [Any instruction]
...
NOTFND [Any instruction]
--
Keep in mind that the number on the BC is not the expected value of the
condition code. BC 1 means branch if the CC is 3. SRST sets CC 3 if the CPU
decides to stop the instruction before it's completed the search. BC 2 *does*
mean branch if CC=2, but that's just the way the mask maps to the CC values.
If you want to branch on character found (CC=1), you'd use BC 4. In this code
that's the fall-through.
Tony H.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2018-01-05 21:26:04 UTC
Permalink
Raw Message
Without looking at the PoOp, doesn't CC=1 indicate that the search has
failed so far, but that more length remains in the register pair, so you
should branch back and keep trying? A number of instructions are
interruptible and work that way.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On
Behalf Of Grinsell, Don
Sent: Friday, January 5, 2018 1:12 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: SRST Question

Has anybody played with the SRST instruction? I am confused by the examples
in the PoP. Why do they branch back to the SRST instruction when the string
is found, e.g. BC 1,LOOP1? Shouldn't the branch be to the FOUND label, e.g.
BC 1,FOUND?

L 5,STRAADR
L 4,STRALEN
AR 4,5
LA 0,X'C1'
LOOP1 SRST 4,5
BC 1,LOOP1
BC 2,NOTFND
FOUND [Any instruction]
...
NOTFND [Any instruction]

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Christopher Y. Blaicher
2018-01-05 21:29:27 UTC
Permalink
Raw Message
He was confusing MASK value with Condition Code.

Chris Blaicher
Technical Architect
Mainframe Development
P: 201-930-8234 | M: 512-627-3803
E: ***@syncsort.com

Syncsort Incorporated
2 Blue Hill Plaza #1563
Pearl River, NY 10965
www.syncsort.com

Data quality leader Trillium Software is now a part of Syncsort.


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Charles Mills
Sent: Friday, January 5, 2018 4:27 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: SRST Question

Without looking at the PoOp, doesn't CC=1 indicate that the search has failed so far, but that more length remains in the register pair, so you should branch back and keep trying? A number of instructions are interruptible and work that way.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Grinsell, Don
Sent: Friday, January 5, 2018 1:12 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: SRST Question

Has anybody played with the SRST instruction? I am confused by the examples in the PoP. Why do they branch back to the SRST instruction when the string is found, e.g. BC 1,LOOP1? Shouldn't the branch be to the FOUND label, e.g.
BC 1,FOUND?

L 5,STRAADR
L 4,STRALEN
AR 4,5
LA 0,X'C1'
LOOP1 SRST 4,5
BC 1,LOOP1
BC 2,NOTFND
FOUND [Any instruction]
...
NOTFND [Any instruction]

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN

________________________________



ATTENTION: -----

The information contained in this message (including any files transmitted with this message) may contain proprietary, trade secret or other confidential and/or legally privileged information. Any pricing information contained in this message or in any files transmitted with this message is always confidential and cannot be shared with any third parties without prior written approval from Syncsort. This message is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any use, disclosure, copying or distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and/or Syncsort and destroy all copies of this message in your possession, custody or control.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Loading...