View previous topic :: View next topic
|
Author |
Message |
vamseepotti
New User
Joined: 21 Oct 2003 Posts: 45
|
|
|
|
Imagine your CURSOR updated 200 rows and COMMIT takes place. Then abend occurred at 201?215. How u know the number of rows updated by ur cursor and where abend occurred. Now, how u modify ur program which donot update the first 200 rows? |
|
Back to top |
|
|
mdtendulkar
Active User
Joined: 29 Jul 2003 Posts: 237 Location: USA
|
|
|
|
Hello vamseepotti,
Code the cursor as below:
Code: |
DECLARE MYCURSOR CURSOR FOR
SELECT COLUMN1, COLUMN2
FROM MYTABLE
WHERE MYKEY > :WS-MY-KEY
|
Initially move LOW-VALUES to WS-MY-KEY.
After every commit, save the key in check point area.
During restart, move the saved key value to WS-MY-KEY and after the open and fetch of the cursor you will have the next record.
Hope this helps,
Regards
Mayuresh Tendulkar |
|
Back to top |
|
|
sosu4u
New User
Joined: 02 Nov 2007 Posts: 2 Location: bangalore
|
|
|
|
we will know how many records updated or deleted from sqlerrd(3). by checking value in sqlerrd (3) we can start retrieving data from that position.
i think it may help for you.
regards,
suresh |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
suresh, you are correct. to keep count use sqlerrd(3).
but I think Mayuresh has a better method of restart,
although,
I would - keep the checkpoint area in a db2 table
- after the cursor update, I would move the last key updated to a db2 checkpoint table and then commit
.
at end of successful job, I would move a low-key to the checkpoint row, update and commit.
to restart, I would first read my checkpoint row and use the last saved key.
that way at the start of a job, the last saved key would be- low if last run of program was successful
- last commited key after an abended run.
|
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
After 6 years this is still not solved? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
but you are (were) the last poster to this thread! |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I hope the original poster has not been sitting at his/her terminal all these years waiting for an answer. |
|
Back to top |
|
|
|