Interesting lookup processing

Kenneth Brody kenbrody at spamcop.net
Wed May 6 20:07:03 PDT 2009


Mike Schwartz wrote:
>      I was looking at some programs written by another programmer over 10
> years ago, and ran into this code that I didn't think would work reliably,
> but it has for over 10 years now:
> 
> -----
> :
> lookup INVEN K=2 (blah, blah)
> -----
> Not INVEN
> Lookup INVEN = ARCINVEN k=2 (blah, blah)
> -----
> :
> 3=INVEN(4)
> -----
> 
> 
>      I would have bet, internally, that filePro would get confused by the
> "dual" use of the word INVEN, especially if one part was found in the active
> inventory file and the next part was found in the archive inventory file.
> 
>      Is this something that potentially could be causing problems, or is
> this perfectly legitimate code?

It's perfectly legal, and is, in fact, one of the reasons for having aliases 
on the lookups.  No "confusion" occurs, since this is part of the design.

A very common use is to perform one lookup, and if it fails, perform another 
one, perhaps to a different file, or a different key.  This is precisely 
what your example does.  It does a lookup into the inventory file, and if it 
fails, it then tries the archive file.

-- 
Kenneth Brody


More information about the Filepro-list mailing list