Note that
LA R9,TABLE1+2 ADDRESS OF BEGINNING OF TABLE
AH R9,TABLE1 CALC ADDR OF END OF TABLE
will not establish the end of table suitable for the BXLE instruction.
The table coded in the example below has a wrong total length (XL2'008F'), you
have forgotten to include the elements length fields.
Also the calculated end of table must be at least 1 byte before the end,
otherwise BXLE will not stop at the end (as BXL would have done, but that
instruction doesn't exist).
It is essential that a correct compare value for BXLE is established, otherwise
it may not work as intended when the search is for an entry not present in the
table.
Gunnar
-----Original Message-----
From: IBM Mainframe Assembler List <[email protected]> On Behalf
Of Mark Young
Sent: Tuesday, June 4, 2024 7:37 PM
To: [email protected]
Subject: Re: BXLE usage assistance
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.