Karen,

 

Don't you need a CLOSE lit2 just before the BREAK in the IF SQLCODE = 100
block?

 

Emmitt Dove

Manager, Converting Applications Development

Evergreen Packaging, Inc.

[email protected]

(203) 214-5683 m

(203) 643-8022 o

(203) 643-8086 f

[email protected]

 

From: [email protected] [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Wednesday, June 10, 2009 9:43 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Nested While with Fetch

 

Geoffrey:  Here's the way I format a 2-cursor routine.   Compare this to
yours and see if 
maybe your structure could be changed to work better.

Karen


DROP CUR lit1 ; DROP CUR lit2
DECLARE lit1 CURSOR FOR SELECT columns FROM table WHERE ... ORDER BY ....
DECLARE lit2 CURSOR FOR SELECT columns FROM table WHERE ... ORDER BY ....
OPEN lit1
WHILE 1 = 1 THEN
  FETCH lit1 INTO vars
  IF SQLCODE = 100 THEN
     BREAK
  ENDIF

   *( do stuff with 1st table)


   OPEN lit2 RESET
   WHILE 1 = 1 THEN
      FETCH lit2 INTO vars
      IF SQLCODE = 100 THEN
         BREAK
      ENDIF

     *(do stuff with the 2nd table)
   ENDWHILE

ENDWHILE
DROP CUR lit1 ; DROP CUR lit2

Karen






Thanks Emmit,
With the variable in question I've tried declaring it with a REAL type
without setting it to a value (this should give it a null value),
initializing it to 0, and not decalaring it (it gives an error - variable
not found).  The first cursor FETCHes values into the variable OK.  The 2
other variables are populated by a variable form and receive valid values.
     Geoffrey

 

Reply via email to