View previous topic :: View next topic |
Author |
Message |
lacoe1 Beginner
Joined: 24 Feb 2005 Posts: 33 Topics: 17
|
Posted: Wed Mar 24, 2010 5:59 pm Post subject: Cursor and Update at the same time |
|
|
I am using a cursor in my Cobol program and it's gathering all the right records. What I would like to do is update some of the records that I have fetched from that cursor. How can I do update at the same time as processing the cursor? |
|
Back to top |
|
 |
NASCAR9 Intermediate
Joined: 08 Oct 2004 Posts: 274 Topics: 52 Location: California
|
Posted: Wed Mar 24, 2010 6:27 pm Post subject: |
|
|
Here's an example: Code: |
EXEC SQL
DECLARE CURPRBL CURSOR WITH HOLD FOR
SELECT SSNO
,MEDDEN_BAL
,LAST_MEDDEN_UP
,USERID
,LASTUPDT
FROM HOURS.PREMBAL
WHERE MEDDEN_BAL < 0
FOR UPDATE OF MEDDEN_BAL, LAST_MEDDEN_UP,
USERID, LASTUPDT
END-EXEC.
EXEC SQL
UPDATE HOURS.PREMBAL
SET MEDDEN_BAL = :PREMBAL-MEDDEN-BAL
,LAST_MEDDEN_UP = :PREMBAL-LAST-MEDDEN-UP
,USERID = :PREMBAL-USERID
,LASTUPDT = :PREMBAL-LASTUPDT
WHERE CURRENT OF CURPRBL
END-EXEC. |
_________________ Thanks,
NASCAR9 |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
lacoe1 Beginner
Joined: 24 Feb 2005 Posts: 33 Topics: 17
|
Posted: Thu Mar 25, 2010 12:31 pm Post subject: |
|
|
Thanks. |
|
Back to top |
|
 |
|
|