Thanks Buddy, I think I forgot second Fetch and Scroll is needed I think because this is happening in a form.
I'm gonna give it another try.
 
Thanks again.
 
Deb Roepken
cmri
[EMAIL PROTECTED]

631-587-1495
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]On Behalf Of Walker, Buddy
Sent: Monday, May 09, 2005 2:10 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - RE: Declare Cursor question

Deb
 
  Not sure what kind of problem you are having but....
 
  Unless you really want the cursor to move forward and backward, I would omit "SCROLL"
 
  Remove the "WHERE CURRENT OF c1" from DECLARE .....
 
  DECLARE ...... WHERE COMIS IS NOT NULL
 
 
 My own preference would be
 
IF .fnegcom = 'T' THEN
   SET VAR negcomis CURR
   SET VAR negshrs  INT
   SET VAR vShares REAL (or whatever the datatype is)
   SET VAR VComis CURR (again whatever the datatype is)
   DECLARE CURSOR c1 SCROLL CURSOR FOR SELECT SHARES, COMIS FROM EQUIT +
      WHERE COMIS IS NOT NULL
   OPEN CURSOR c1
   FETCH LAST FROM EQUIT INTO negshrs INDICATOR vinegshrs, +
      tmrate INDICATOR vitmrate
  WHILE SQLCODE <> 100 THEN
         IF tmrate IS NOT NULL THEN
            SET VAR negcomis = (.tmrate * .negshrs)
            UPDATE EQUIT SET whatcolumn = .negcomis WHERE CURRENT OF C1
         ENDIF
    FETCH LAST FROM EQUIT INTO negshrs INDICATOR vinegshrs, +
      tmrate INDICATOR vitmrate
 ENDWHILE
  DROP CURSOR c1
ENDIF
 
 
Buddy


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Deb Roepken
Sent: Monday, May 09, 2005 1:32 PM
To: RBG7-L Mailing List
Subject: [RBG7-L] - Declare Cursor question

Hi-
Can someone tell me what I'm doing wrong here? 
 
IF .fnegcom = 'T' THEN
   SET VAR negcomis CURR
   SET VAR negshrs  INT
   DECLARE CURSOR c1 SCROLL CURSOR FOR SELECT SHARES, COMIS FROM EQUIT +
      WHERE CURRENT OF c1
   OPEN CURSOR c1
   FETCH LAST FROM EQUIT INTO negshrs INDICATOR vinegshrs, +
      tmrate INDICATOR vitmrate
      IF SQLCODE = 0 THEN
         IF tmrate IS NOT NULL THEN
            SET VAR negcomis = .tmrate * .negshrs
         ENDIF
      ENDIF
ENDIF
CLOSE c1
DROP CURSOR c1
 
Thanks, all comments are appreciated.

Deb Roepken
cmri
[EMAIL PROTECTED]

631-587-1495

 

<<attachment: Glacier Bkgrd.jpg>>

Reply via email to