Hi Gunnar,

I like your solution, but you have changed the lengths in the original
table.  I don't know if the OP (Mark) haa that option.

Peter

On Thu, 6 Jun 2024 at 10:31, <g...@altiboxmail.no> wrote:

> Hi
>
> I think the BXLE instruction is not used correct in the proposed
> solution.  From the manual's description:
>
> BXLE R1,R3,D2(B2)
> "When the R3 field is even, it designates a pair of registers;
> the contents of the even and odd registers of
> the pair are used as the increment and the compare
> value, respectively. When the R3 field is odd, it designates
> a single register, the contents of which are
> used as both the increment and the compare value."
>
> Using the syntax of BXLE described above:
> The 1st operand, R1, should point to the current entry in the table.
> The second operand, D2(B2),  should point to the beginning of the loop.
> The 3rd operand, R3, should be an even register, and contain the increment.
> The odd register, R3+1, should point before the end of the table, but not
> before the last entry in the table.
>
> The program will be simplest when the length fields are considered part of
> the entry.
> Using registers 7,8,9, where 7 points to the current entry, 8 has the
> increment, and 9 has the compare value.
>
>            LA     7,ENT1                            point to 1st entry
>            LA     9,END-1                          point to 1 before the
> end of table (since the loop instruction is BXLE and not BXL)
> LOOP CLC   2(9,7),=C'FFFFFFFFF'     test for a specific entry
>            BE     FOUND                            leave loop if found
>            LH     8,0(7)                               length of current
> entry
>            BXLE 7,8,LOOP                        increment entry pointer to
> next entry
>            B       NOTFOUND                    the specific entry was not
> found
>
> ENT1 DC    AL2(ENT2-ENT1),CL14'AAAAAAAAAAAAAA'      length of 1st entry,
> and value of 1st entry
> ENT2 DC    AL2(ENT3-ENT2),CL15'BBBBBBBBBBBBBBB'      length of 2nd entry,
> and value of 2nd entry
> ENT3 DC    AL2(ENT4-ENT3),CL17'CCCCCCCCCCCCCCCCC'
> ENT4 DC    AL2(ENT5-ENT4),CL13'DDDDDDDDDDDDD'
> ENT5 DC    AL2(ENT6-ENT5),CL23'EEEEEEEEEEEEEEEEEEEEEEE'
> ENT6 DC    AL2(ENT7-ENT6),CL9'FFFFFFFFF'
> ENT7 DC    AL2(ENT8-ENT7),CL19'GGGGGGGGGGGGGGGGGGG'
> ENT8 DC    AL2(ENT9-ENT8),CL25'HHHHHHHHHHHHHHHHHHHHHHHHH'
> ENT9 DC    AL2(END-ENT9),CL8'IIIIIIII'
> END   EQU  *
>
> There is still a bug here, since the CLC may test beyond the end of the
> table (if the entry tested for is not found).
> The entry length should be checked first, and if not equal then branch to
> the LH instruction.
>
> Gunnar
>
>
>
>
>
>
> -----Original Message-----
> From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On
> Behalf Of Mark Young
> Sent: Wednesday, June 5, 2024 6:08 PM
> To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
> Subject: Re: BXLE usage assistance
>
> Thanks Peter,
>
> I tested the program with your suggested updates and it worked. I tried
> all the entries in the table and it worked for all of them.
> Thanks again for your help. Very much appreciated.
>
> Thanks,
> Mark.
> .
>
> On Wed, Jun 5, 2024 at 3:42 AM Peter Vels <peter.v...@gmail.com> wrote:
>
> > Hi Mark,
> >
> > Try this:
> >
> > <snip>
> > CHKOPTS1 LA    R7,TABLE1+4             ADDRESS OF FIRST ELEMENT
> >          LH    R8,TABLE1+2             LENGTH OF TABLE ENTRY
> >          LR    R6,R8                   SAVE R8 FOR LATER
> >          LA    R9,TABLE1+2             ADDRESS OF BEGINNING OF TABLE
> >          AH    R9,TABLE1               CALC ADDR OF END OF TABLE
> >
> > LOOP1    CLC   0(9,R7),=C'FFFFFFFFF'
> >          JE    FOUND                   ENTRY FOUND = RC=0
> > * --->>>   LH    R8,0(2,R7)  <<<---      POINT TO LENGTH OF NEXT ENTRY
> >          LR    R8,R6                   RESTORE R8
> >          LH    R6,0(R8,R7)             PUT THE NEXT LENGTH INTO R6
> >          LA    R7,2(R7)                SKIP OVER THE LENGTH FIELD
> >          BXLE  R7,R8,LOOP1             LOOPING UNTIL OPT FOUND
> > <snip>
> >
> > I don't like that I used an extra register, R6, so I'm hoping someone
> > can improve it.
> >
> > Peter
> >
> > On Wed, 5 Jun 2024 at 03:58, Mike Shaw <quick...@gmail.com> wrote:
> >
> > > Mark,
> > >
> > > You are coding a length (the 2) in the 2nd operand of your LH
> > > instruction...that 2 is being used by the machine as register 2. LH
> > always
> > > loads two bytes.
> > >
> > > Mike Shaw
> > > MVS/QuickRef Support
> > > Chisoft
> > >
> > >
> > > On Tue, Jun 4, 2024, 1:38 PM Mark Young <ca45...@gmail.com> wrote:
> > >
> > > > Thanks for all the replies.  See the code sample below.  I'm
> > > > getting
> > > stuck
> > > > trying to get the length for the next table entry into R8 so the
> > > > BXLE instruction loop the correct length.  Let me know if I'm on the
> correct
> > > > path, or I'm in never never land.   Also, the --->>>          <<<---
> is
> > > > where I think I'm getting stuck.
> > > >
> > > > TESTBXLE CSECT ,
> > > > TESTBXLE AMODE 31
> > > > TESTBXLE RMODE ANY
> > > >          SAVE  (14,12),,TESTBXLE*&SYSDATE*&SYSTIME
> > > >          BALR  R12,0                   R12 - BASE REGISTER
> > > >          USING *,R12                   ESTABLISH ADDRESSABILITY
> > > >          ST    R13,SAVEAREA+4          SAVEAREA
> > > >          LA    R13,SAVEAREA            POINTERS
> > > > *
> > > > CHKOPTS1 LA    R7,TABLE1+4             ADDRESS OF FIRST ELEMENT
> > > >          LH    R8,TABLE1+2             LENGTH OF TABLE ENTRY
> > > >          LA    R9,TABLE1+2             ADDRESS OF BEGINNING OF TABLE
> > > >          AH    R9,TABLE1               CALC ADDR OF END OF TABLE
> > > > LOOP1    CLC   0(9,R7),=C'FFFFFFFFF'
> > > >          BE    FOUND                   ENTRY FOUND = RC=0
> > > > --->>>   LH    R8,0(2,R7)  <<<---      POINT TO LENGTH OF NEXT ENTRY
> > > >          BXLE  R7,R8,LOOP1             LOOPING UNTIL OPT FOUND
> > > >          B     NOTFND                  ENRTY NOT FOUND ? RC=8
> > > > *
> > > > FOUND    L     R13,SAVEAREA+4
> > > >          RETURN (14,12),RC=0
> > > > *
> > > > NOTFND   L     R13,SAVEAREA+4
> > > >          RETURN (14,12),RC=8
> > > > *
> > > >          PRINT NOGEN
> > > >          YREGS
> > > > SAVEAREA DS    18F
> > > > TABLE1   DS    0F
> > > >          DC    XL2'008F'
> > > >          DC    XL2'000E',CL14'AAAAAAAAAAAAAA'
> > > >          DC    XL2'000F',CL15'BBBBBBBBBBBBBBB'
> > > >          DC    XL2'0011',CL17'CCCCCCCCCCCCCCCCC'
> > > >          DC    XL2'000D',CL13'DDDDDDDDDDDDD'
> > > >          DC    XL2'0017',CL23'EEEEEEEEEEEEEEEEEEEEEEE'
> > > >          DC    XL2'0009',CL9'FFFFFFFFF'
> > > >          DC    XL2'0013',CL19'GGGGGGGGGGGGGGGGGGG'
> > > >          DC    XL2'0019',CL25'HHHHHHHHHHHHHHHHHHHHHHHHH'
> > > >          DC    XL2'0008',CL8'IIIIIIII'
> > > >          END   TESTBXLE
> > > >
> > > >
> > > > Thanks,
> > > > Mark.
> > > >
> > >
> >
>

Reply via email to