× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: bsearch on partial array elements
  • From: Joel Fritz <JFritz@xxxxxxxxxxxxxxxx>
  • Date: Thu, 13 Jan 2000 09:11:49 -0800

I'm assuming you're using the C function.  Seems to me you can write your
comparison procedure to consider only the first 30 bytes of the array
element.  E.g. 


when lookupval = %subst(cellval, 1, 30)
       ....................

or use a data structure if you're worried about overhead.


> -----Original Message-----
> From: David.Biggs@bernardmatthews.com
> [mailto:David.Biggs@bernardmatthews.com]
> Sent: Thursday, January 13, 2000 7:45 AM
> To: rpg400-l@midrange.com
> Subject: bsearch on partial array elements
> 
> 
> 
> 
> I have an RPG IV program in which I am using 'bsearch' to 
> search a number of
> arrays, which is working fine (and quickly too !). However, 
> one of the arrays is
> defined with an element length of 37A, but I want to search 
> it by the first 30
> bytes only.
> The trailing 7 bytes of the array elements will not contain 
> blanks, so I assume
> that the bsearch routine will not work correctly when 
> comparing 30A to 37A.
> 
> Any ideas how I can get round this without creating more arrays ?
> 
> TIA,
> Dave Biggs
> 
> 
> 
> 
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to 
> RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator: 
> david@midrange.com
> +---
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.