In the example of code you have, the loop will exit if your key (variable ID) 
is equal to an empty string or a string that can be evaluated to zero for 
example values like these:
0E1,0E10, 0E100  (on Universe)
"" (empty string)
0000

Will make the loop end:

> SELECT FILENAME
> LOOP
>    READNEXT ID ELSE EXIT
> WHILE ID DO                           
>    CODE
>    CODE with GOSUB
>    CODE
>    CODE
> REPEAT

Try:

SELECT FILENAME
LOOP WHILE READNEXT ID
  CODE...
REPEAT




----- Original Message ----
From: George Gallen <ggal...@wyanokegroup.com>
To: "u2-users@listserver.u2ug.org" <u2-users@listserver.u2ug.org>
Sent: Friday, February 27, 2009 10:21:19 AM
Subject: RE: [U2] Strange happening...

that wasn't the case. The id was combination of 13 letters and numbers.
The strange part was where the while/do seemed to kick in.
   The item was read from the file without a problem
   3-4 lines of code execute as expected
   it then executed a gosub, but when it returned, it dropped out of the loop
      the id variable was never modified.

Strange.

George

> -----Original Message-----
> From: owner-u2-us...@listserver.u2ug.org [mailto:owner-u2-
> us...@listserver.u2ug.org] On Behalf Of Edward Brown
> Sent: Friday, February 27, 2009 9:39 AM
> To: u2-users@listserver.u2ug.org
> Subject: RE: [U2] Strange happening...
>
> If the ID equates to false it will exit - i.e. a record with ID 000000
>
> Edward
>
> -----Original Message-----
> From: owner-u2-us...@listserver.u2ug.org
> [mailto:owner-u2-us...@listserver.u2ug.org] On Behalf Of George Gallen
> Sent: 27 February 2009 14:26
> To: Ardent
> Subject: [U2] Strange happening...
>
> ok...I found this code snipit (REALITY FLAVOR)
>
> SELECT FILENAME
> LOOP
>    READNEXT ID ELSE EXIT
> WHILE ID DO
>    CODE
>    CODE with GOSUB
>    CODE
>    CODE
> REPEAT
>
>
> What was happening was the loop was exiting early,  but it was exiting
> after
> the
> CODE with GOSUB line was executed.
>
> What struck me was why there was a While DO as well as an EXIT in the
> loop?
> while nothing in the CODE or GOSUBs modified the ID, would having both
> the
> WHILE/DO and EXIT cause some kind of problem?
>
> After I removed (commented out) the WHILE/DO line, the program ran as
> expected
> and processed the 100,000 records, (whereas before it stopped after 6).
>
> George
> -------
> u2-users mailing list
> u2-users@listserver.u2ug.org
> To unsubscribe please visit http://listserver.u2ug.org/
>
> -----------------------------------------------------------------------
> --------------------
> Please remember to recycle wherever possible.
> Reduce, reuse, recycle, think do you need to print this e-mail?
> -----------------------------------------------------------------------
> --------------------
> This e-mail and any attachment(s), is confidential and may be legally
> privileged. It is intended solely for the addressee. If you are not the
> addressee, dissemination, copying or use of this e-mail or any of its
> content is prohibited and may be unlawful. If you are not the intended
> recipient please inform the sender immediately and destroy the e-mail,
> any attachment(s) and any copies. All liability for viruses is excluded
> to the fullest extent permitted by law. It is your responsibility to
> scan or otherwise check this email and any attachment(s). Unless
> otherwise stated (i) views expressed in this message are those of the
> individual sender (ii) no contract may be construed by this e-mail.
> Emails may be monitored and you are taken to consent to this
> monitoring.
>
> Civica Services Limited, Company No. 02374268; Civica UK Limited,
> Company No. 01628868
> Both companies are registered in England and Wales and each has its
> registered office at 2 Burston Road, Putney, London, SW15 6AR.
> -----------------------------------------------------------------------
> --------------------
> -------
> 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/
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to