IMO, it would have been less complicated and even easier to read if you had
separated the list with @VM or @AM instead of back-slash.  That way you
could have used the LOCATE, which in itself explains what you are trying to
achieve.  If you had also made the list sorted then you could have used the
LOCATE with 'AL' which would have been quicker as well.

Regards, Neil.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Keith Johnson
(DSLWN)
Sent: 25 November 2007 20:52
To: [email protected]
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
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/


-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.6/1150 - Release Date: 24/11/2007
17:58
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to