The original "new" INDEX code (as posted by Keith) was...

IF INDEX(TEST,'\':F200.SCHEME.CODE:'\',1) THEN THAT =

Including the delimiters at the front & back of the string, which
prevents any false positives (like finding "CK" in "CK1").

Personally, I like the LOCATE solution as it makes for much more
readable & obvious code, eg.

LOCATE CODE IN VALID.SCHEME.CODES<1> ...

But, if you're solely looking for speed, I'm pretty sure INDEX is the
quickest way to go.

Another possibility would be to use MATCHES, which works well (but only
for shorter lists), eg.

VALID.CODES = "AF1}CK1}CK2}H}LHC}MP}NU1}NU2}TK1}TK2" 
IF TEST MATCHES VALID.CODES THEN...

or even...

THAT = (TEST MATCHES VALID.CODES)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of MAJ Programming
Sent: Monday, 26 November 2007 1:03 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Good Practice?

I find this kind of evolved junk a lot. There's one caveat that you
should
include:

TEST = '\AF1\CK1\CK2\H\LHC\MP\NU1\NU2\TK1\TK2\'
CONVERT "\" TO CHAR(254) IN TEST
LOCATE F200.SCHEME.CODE IN TEST SETTING FOUND THEN ELSE............

While actual mileage may differ, when having a lookup table and using
INDEX, the value of F200.SCHEME.CODE of CK will trigger a false
positive.

I like to boil down complex boolean expressions into readable words as
well.
Somehow causes clarity, especially with very verbose variable names.

MJ


DISCLAIMER:
Disclaimer.  This e-mail is private and confidential. If you are not the 
intended recipient, please advise us by return e-mail immediately, and delete 
the e-mail and any attachments without using or disclosing the contents in any 
way. The views expressed in this e-mail are those of the author, and do not 
represent those of this company unless this is clearly indicated. You should 
scan this e-mail and any attachments for viruses. This company accepts no 
liability for any direct or indirect damage or loss resulting from the use of 
any attachments to this e-mail.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to