I believe you would be safer if you replaced part of the code with 'BREAK'

DECLARE c1 SCROLL CURSOR FOR SELECT ...
OPEN c1
WHILE SQLCODE <> 100 THEN
  FETCH c1 INTO ...
-- This has already been covered in the WHILE ...
--  IF SQLCODE = 100 THEN
--    BREAK
--  ENDIF 
  INSERT INTO ...
  EDIT USING ...
-- At this point, a BREAK would be cleaner
  IF vescape = 'T' THEN
     BREAK
  ENDIF

ENDWHILE
CLEAR ALL V
DROP CURSOR c1
RETURN         <-- THIS OK?


--- James Hageman <[EMAIL PROTECTED]> wrote:

> The following code runs with no errors but I am wondering if it's Kosher.
> Specificaly if vescape = 't' and I return to the form that calls the eep 
> in the middle of the while loop is that going to cause problems for me 
> later?
> 
> ----------------------------------------------------------------
> --other code blah blah
> --
> DECLARE c1 SCROLL CURSOR FOR SELECT ...
> OPEN c1
> WHILE SQLCODE <> 100 THEN
>   FETCH c1 INTO ...
>   IF SQLCODE = 100 THEN
>     BREAK
>   ENDIF
>   INSERT INTO ...
>   EDIT USING ...
> 
>   IF vescape = 'T' THEN
>     CLEAR ALL V
>     DROP CURSOR c1
>     RETURN         <-- THIS OK?
>   ENDIF
> 
> ENDWHILE
> DROP CURSOR c1
> 
> --other code follows that I don't want run if VAR vescape = 'T'
> ...
> ...
> ...
> return
> --eof---------------------------------------------------------
> 
> 


Albert Berry 
Management Consultant
RR2 - 1252 Ponderosa Drive
Sparwood BC, V0B 2G2 
Canada
(250) 425-5806
(250) 425-7259
(708) 575-3952 (fax)
[EMAIL PROTECTED]

Reply via email to