Using attribute variables (@am or AM or CHAR(254)) in the string is a waste
of typing. Try this:

TEST="A.B.C.D.E.F.G.H.I.J.K.L.M.N"
CONVERT "." TO CHAR(254) IN TEST.

I do this zillions of times with no downside. Again, using LOCATE will
eliminate false positives.

MJ
----- Original Message -----
From: "Keith Johnson (DSLWN)" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, November 25, 2007 7:50 PM
Subject: [U2] Good Practice?


> Neil suggested using LOCATE rather than INDEX in my example.
>
> I'm not sure I agree that would be any less complex as far as the code
> is concerned.  INDEX and LOCATE are both 'complex' compared with the IF
> statement, and since LOCATE needs its SETTING variable, it's arguably
> the more complex statement.  There are three different forms of LOCATE,
> so that can cause problems. Lastly, the variable TEST has to be set up
> with attribute marks either by multiple lines or by the very long line
> below; which, I have to say, I don't find very readable at all.
>
> TEST =
> 'AF1':@AM:'CK1':@AM:'CK2':@AM:'GS1':@AM:'H':@AM:'JM':@AM:'LHC':@AM:'MP':
> @AM:'MP3':@AM:'NU1':@AM:'NU2':@AM:'TK1':@AM:'TK2'
>
> There may be a slight speed benefit in restricting the scan by using
> 'AL'; but this is not material (or possibly even detectable?) in strings
> of this length.  There is also an ongoing  maintenance risk because the
> next programmer might not notice the codes were sorted, and may just add
> a new one to the end of the string.
> Regards, Keith.
> -------
> u2-users mailing list
> [email protected]
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to