The time to do compares is likely to pale into insignificance compared to looping around a two dimensional unsorted array, unless the sizes are trivial...
I'd be inclined to have a cli/clc pair for each element. I'd also be thinking hard about sorting or indexing the array being searched. Sent from my iPad > On Jun 17, 2017, at 1:15 PM, retired mainframer <[email protected]> > wrote: > > If asterisks will only appear in the first position of a field, you could > use a TRT instruction to determine if (and where) an asterisk appears. If > one does appear, the position would let you "calculate" which field it > appears in so you can move the corresponding data into the compare operand. > If more than one field of a table entry can contain an asterisk, you would > need to repeat the test until no asterisks remained. > > If your outer loop is over the table elements and your inner loop is over > the structure data, then I would set a flag for each field of the table > containing an asterisk. Then you need only test the flags to determine > which structure data needs to be copied to the compare operand. > > But if you have to do I/O for the structure data, you may want the opposite > loop order so you would read each structure element only once. If the > number of entries in the Acceptable Values table is reasonable, you could > preprocess them into an array of flags and avoid multiple I/Os for that data > also. > >> -----Original Message----- >> From: IBM Mainframe Assembler List [mailto:ASSEMBLER- >> [email protected]] On Behalf Of [email protected] >> Sent: Saturday, June 17, 2017 8:55 AM >> To: [email protected] >> 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 >> ************
