While that is an expression of combining statements, it will grow out of
hand. Here's the extension of my suggestion.

TEST="A.B.C.D.E"  ;* FIRST SET, JAN 2005
TEST<-1>="F.G.H.I.J.K.L" ;* SECOND SET. ADDED DEC 2006
TEST<-1>="M.N.O.P.Q.R" ;* SALES DEPT NEEDS MORE. APR 2007
TEST<-1>="S.T.U.V.W.X.Y.Z" ;* ACCOUNTING WANTS SOME. NOV 07.
CONVERT "." TO CHAR(254) IN TEST
LOCATE SOUGHT IN TEST SETTING FOUND THEN ELSE.....

Now, we need not convert this exercise into saying "Why not use an external
table". That's not the point. The point is having a hard coded table within
a program.

This method allows the TEST set to grow in a nicely visible way without
stretching a very long variable. Plus, for most programmers without a
windows-like editor, the chance of messing up when appending to a long
wrapped-around string is high as well.

My 1 cent.
Mark Johnson

PS. The argument that LOCATE adds a cycle or two with the SETTING clause is
weak. Given the verbose programming we all have seen, the SETTING clause
ain't going to break anything.

----- Original Message -----
From: "Kate Stanton" <[EMAIL PROTECTED]>
To: <u2-users@listserver.u2ug.org>
Sent: Sunday, November 25, 2007 10:01 PM
Subject: Re: [U2] Good Practice?


> How about: TEST =
> CHANGE('AF1,CK1,CK2,GS1,H,J,LHC,MP,MP3,NU1,NU2,TK1,TK2',',',@FM)
>
> ----- Original Message -----
> From: "Keith Johnson (DSLWN)" <[EMAIL PROTECTED]>
> To: <u2-users@listserver.u2ug.org>
> Sent: Monday, November 26, 2007 1: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'
> >
> <SNIP>
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to