|
Jon: I did not include the sort in the code snipet I posted, but it I do have it in the program. I was following the Who Knew You Could do That in RPGIV Redbook, it was just a little different & I was confused... Thanks for your help!!! Steve Jones "Jon Paris" <Jon.Paris@xxxxxxxxxxxxxx> Sent by: rpg400-l-bounces+sjones=hpproducts.net@xxxxxxxxxxxx 11/01/2005 01:43 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To <rpg400-l@xxxxxxxxxxxx> cc Subject RE: Bsearch Just from a quick look - shouldn't you be computing the element number by using the address of Items rather than the address in Template? At a cursory glance I can't even see that you set Template at all. Also, even if you fix this, you will still have problems unless you sort the array after adding an element. When you add a new element it just goes at the end, and I see no sign that you sort after adding the entry. bsearch uses a binary search technique (hence the "b") and the array has to be in sequence for it to work. Jon Paris Partner400 www.Partner400.com www.RPGWorld.com
As an Amazon Associate we earn from qualifying purchases.
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.