I think the OP's data is unsorted, so regardless of the answer, the question may be moot here
Keven > On Jun 18, 2017, at 18:32, Richard Kuebbing <rkueb...@tsys.com> wrote: > > Is a binary search ever appropriate on machines like the Z where the penalty > for not being in the cache is so high? > > -----Original Message----- > From: IBM Mainframe Assembler List [mailto:ASSEMBLER-LIST@LISTSERV.UGA.EDU] > On Behalf Of esst...@juno.com > Sent: Saturday, June 17, 2017 11:55 AM > To: ASSEMBLER-LIST@LISTSERV.UGA.EDU > Subject: Table Searchig with a Mask > > Hi everyone > > I would like some help in reducing the number of instructions required to > search a table. > The table is in no particular order, so a Binary Search may not be > appropriate here. > . > . > I will try to explain this. > . > I have a structure with X number of fields For this example lets assume: > STRUCTURE EQU * > USERID DS CL8 > COMPANY_CODE DS CL4 > JOB_NAME DS CL8 > FILE DS CL8 > > I also have an Array (table) of Acceptable Values with the same elements > as my structure. > I can search the table using a single compare for a length of 28. > . > . > However some of the table entries contain an asterisk "*" in the first > position of the respective field. The asterisk means to accept any value from > the structure. > For Example: > ARRAY EQU * > TUSERID DC CL8'JOSEPH ' > TCOMPANY_CODE DC CL4'* ' > TJOB_NAME DC CL8'REPORT ' > TFILE DC CL8'* ' > . > In order to search the table using a single compare instruction, I would need > to overlay the respective elements in the structure with the Asterisk from > the corresponding element in the Array Table Entry. > . > This would mean I would need to compare each element in the ARRAY entry for > the Asterisk, and if present move the corresponding field to the structure. > CLI TCOMPANY_CODE,=C'*' > JNE NEXT_ELEMENT > MVC COMPANY_CODE,TCOMPANY_CODE . > I prefer not to test each element in the ARRAY for an Asterisk and Move them > individually to the structure, prior to comparing the structure with the > Array Entry. > . > I'm not aware of any instruction that will move selectively all fields with > an Asterisk "*". Which Is what I am looking for, then I can use a single move > or four Moves and continue to use a single compare instruction. > . > Again I'm looking for the fewest amount of instructions to accomplish this. > . > What Alternatives are there ? > A long time ago I did see someone do something similar with a Translate and > Test. > But again this is several iterations of TRT and a Move for each Array element. > . > > Thank You > Paul D'Angelo > ************ > > > ----------------------------------------- The information contained in this > communication (including any attachments hereto) is confidential and is > intended solely for the personal and confidential use of the individual or > entity to whom it is addressed. The information may also constitute a legally > privileged confidential communication. If the reader of this message is not > the intended recipient or an agent responsible for delivering it to the > intended recipient, you are hereby notified that you have received this > communication in error and that any review, dissemination, copying, or > unauthorized use of this information, or the taking of any action in reliance > on the contents of this information is strictly prohibited. If you have > received this communication in error, please notify us immediately by e-mail, > and delete the original message. Thank you