|
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Luis Rodriguez
Sent: Thursday, December 16, 2010 3:54 PM
To: RPG programming on the IBM i / System i
Subject: Re: Problem using tlookup bif
Dennis,
This problem has piqued my curiosity, as LOOKUP is a opcode that I have
not
used in a (very) long time. I found this in a Bob Cozzi article (
http://systeminetwork.com/article/built-functions-you-might-not-be-
using-fully
)
:
"One thing that needs to be pointed out is that the %LOOKUP built-in
function performs a different routine to search the array than does the
legacy LOOKUP opcode. So there is a chance you could get a different
result
if you blindly convert LOOKUP opcodes to %LOOKUP built-in functions.
LOOKUP generated a subroutine based on the Resulting Indicators and
performed a sort of linear scan to locate matching elements,
whereas %LOOKUP
uses a binary search routine to find the elements. This means that if
the
data is not sequenced, %LOOKUP could fail to locate the elements even
if
they exist."
I wonder if David found a solution to his problem?
Regards,
Luis Rodriguez
IBM Certified Systems Expert - eServer i5 iSeries
--
On Thu, Dec 16, 2010 at 1:59 PM, Dennis Lovelady
<iseries@xxxxxxxxxxxx>wrote:
Yes. So that would be relevant if David were using %TLOOKUPxx. Buthe's
not. He's using the %TLOOKUP, which does not use binary search.subject."
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A fanatic is one who can't change his mind and won't change the
-- Winston Churchilldoes.
It looks to me like %TLOOKUPxx uses a binary search, as %lookupxx
for
"Since a binary search is used by the %LOOKUPxx built-in functions
depends ona
sequenced array, and the correct function of a binary search
ofthe data being in order, the search may only look at a few elements
isthe array. When the array is out of order, the result of a binary
search
is unpredictable. "
On 12/16/2010 10:23 AM, Dennis Lovelady wrote:
The manual refers to both kinds of lookups. The kind that David
The %TLOOKUPusing is
not of the %TLOOKUPxx set, the nearest I can determine.
matchBIF
works by comparing each value starting with 1 and ending when a
language.is
found or the end of the table is reached. Sequence is immaterial.Or at
least that's the way it was the first 35 years or so of the
way
Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A diplomat is a person who can tell you to go to hell in such a
mailingthat
you actually look forward to the trip."--
-- Caskie Stinnett
This is the RPG programming on the IBM i / System i (RPG400-L)
mailing listlist
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the IBM i / System i (RPG400-L)
To post a message email: RPG400-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.