But this is so much easier to read (note the liberal use of blank lines
making the conditions easy to spot):

   LOOP
   WHILE READNEXT ID
      GOSUB PROCESS.REC
   REPEAT

   RETURN 

PROCESS.REC:
************

   READ RECORD FROM FILE,ID
      ELSE RETURN

   IF RECORD<FLD.1> NE COND1
      THEN RETURN
   
   IF RECORD<FLD.2> NE COND2
      THEN RETURN

   IF RECORD<FLD.3> NE COND3
      THEN RETURN

   RECORD<FLD.4> = 'PROCESSED'
   WRITE RECORD TO FILE, ID

   RETURN

(hopefully the mail list didn't screw with the formatting)

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere
Sent: Friday, 30 November 2007 1:46 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Deep and long indentations vs multiple exit points

<snip>
I had to look up the "CONTINUE" statement.  In 25 years I've never used
it, and don't even remember seeing it used.  Now I know what it does I
think it should be banned.
</snip>

I  use CONTINUE all the time when processing records that must meet
multiple conditions in a loop. This way my code doesnt look like 'flying
geese'. I will write:

LOOP WHILE READNEXT ID
   READ RECORD
FROM FILE, ID ELSE CONTINUE
   IF RECORD<FLD.1> NE COND1 THEN CONTINUE
   IF
RECORD<FLD.2> NE COND2 THEN CONTINUE
   IF RECORD<FLD.3> NE COND3 THEN
CONTINUE
   RECORD<FLD.4> = 'PROCESSED'
   WRITE RECORD TO FILE, ID
REPEAT
instead of:

LOOP WHILE READNEXT ID
   READ RECORD FROM FILE,ID THEN
      IF
RECORD<FLD.1> EQ COND1 THEN
         IF RECORD<FLD.2> EQ COND2 THEN
IF RECORD<FLD.3> EQ COND3 THEN
               RECORD<FLD.4> = 'PROCESSED'
WRITE RECORD TO FILE, ID
            END
         END
      END
   END
REPEAT
___________________________________________________________
Yahoo! Answers -
Got a question? Someone out there knows the answer. Try it now.
http://uk.answers.yahoo.com/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


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