I tend to use:

SELECT FILENAME
EOF = @FALSE
LOOP
READNEXT ID ELSE EOF = @TRUE
UNTIL EOF DO
CODE
CODE
CODE with GOSUB
CODE
CODE
REPEAT

The advantage here is that it allows you to bail out of the loop of you want to by setting EOF

David

--------------------------------------------------
From: "George Gallen" <ggal...@wyanokegroup.com>
Sent: Monday, March 02, 2009 6:01 PM
To: <u2-users@listserver.u2ug.org>
Subject: RE: [U2] Strange happening...

It shouldn't, at least not to a empty ID because the
condition test is on the READNEXT, not the ID.

However, it will pass an empty ID to the coding, which
could be worse, if there aren't constraint checks on
the ID.

George

-----Original Message-----
From: owner-u2-us...@listserver.u2ug.org [mailto:owner-u2-
us...@listserver.u2ug.org] On Behalf Of Eric Armstrong
Sent: Monday, March 02, 2009 11:28 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Strange happening...

Allen,
Regarding your loop structure below. What happens if the ID is empty
string?
Won't it bail out before all the ids are read!

Eric Armstrong
Lobel Financial
IT Dept


-----Original Message-----
From: Allen Egerton [mailto:aeger...@pobox.com]
Sent: Friday, February 27, 2009 8:37 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Strange happening...

As for the loop structure, I tend to like this:
SELECT FILENAME
LOOP WHILE READNEXT ID
  CODE
  CODE
  CODE with GOSUB
  CODE
  CODE
REPEAT

It's clean, it's concise, it's easy to read...  And I wish I could
remember who taught me that you could combine the LOOP and READNEXT in
that manner...

--
Allen Egerton
aegerton at pobox dot com
PGP Key ID 0x8EA57261
-------
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