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 ----- Original Message ----- From: "Keith Johnson (DSLWN)" <[EMAIL PROTECTED]> To: <u2-users@listserver.u2ug.org> Sent: Sunday, November 25, 2007 3:52 PM Subject: [U2] Good Practice? > Here's an example of how I rewrote some code. > > Old version > 284: * IF F200.SCHEME.CODE = "CK1" OR F200.SCHEME.CODE = "CK2" > OR F200.SCHEME.CODE = "NU1" OR F200.SCHEME.CODE = "NU2" OR > F200.SCHEME.CODE = "TK1" OR F200.SCHEME.CODE = "TK2" OR F200.SCHEME.CODE > = "GS1" OR F200.SCHEME.CODE = "JM" OR F200.SCHEME.CODE = "MP3" OR > F200.SCHEME.CODE = "LHC" OR F200.CALC.CODE = "H" OR F500.S91.ANNUITY.SEQ > + 0 >= 2 OR F500.S48.ANNUITY.SEQ + 0 >= 2 OR F200.SCHEME.CODE = "AF1" OR > F200.SCHEME.CODE = "MP" THEN ; *002 > 285: IF F200.SCHEME.CODE = "CK1" OR F200.SCHEME.CODE = "CK2" OR > F200.SCHEME.CODE = "NU1" OR F200.SCHEME.CODE = "NU2" OR F200.SCHEME.CODE > = "TK1" OR F200.SCHEME.CODE = "TK2" OR F200.SCHEME.CODE = "LHC" OR > F200.CALC.CODE = "H" OR F500.S91.ANNUITY.SEQ + 0 >= 2 OR > F500.S48.ANNUITY.SEQ + 0 >= 2 OR F200.SCHEME.CODE = "MP" OR > F200.SCHEME.CODE = "AF1" THEN ; *002*003 > > New version > 261: THAT = @TRUE > 262: * TEST = '\AF1\CK1\CK2\GS1\H\JM\LHC\MP\MP3\NU1\NU2\TK1\TK2\' > 263: TEST = '\AF1\CK1\CK2\H\LHC\MP\NU1\NU2\TK1\TK2\' > 264: IF INDEX(TEST,'\':F200.SCHEME.CODE:'\',1) THEN THAT = > @FALSE > 265: > 266: IF F500.S91.ANNUITY.SEQ + 0 GE 2 THEN THAT = @FALSE > 267: IF F500.S48.ANNUITY.SEQ + 0 GE 2 THEN THAT = @FALSE > > I think the new version is easier to maintain (well I would say that), > but the code itself is more complex; which is rather interesting. > > > Regards, Keith > ------- > 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/