View previous topic :: View next topic
|
Author |
Message |
krishnakanth Warnings : 1 New User
Joined: 01 Feb 2006 Posts: 3
|
|
|
|
Hi All,
i have a doubt in DB2.
An application program is updating 100 rows in a table.
the job got abended after 50 records are updated.from here if i restart the job. The updation is starting from 1st record,i don't want from 1st.
i want it to update from 51st record.
how to do this task???
how can one know that 50 records r updated before the job is abended.
u r help is highly appreciated.......
Krishnakanth. |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
Hi,
The number of records got updated can be known by using a count in the loop. Then use restart logic by using this count after the abend to load from the last record updated. |
|
Back to top |
|
|
krishnakanth Warnings : 1 New User
Joined: 01 Feb 2006 Posts: 3
|
|
|
|
Hi Nuthan,
Can u pls explain this in more practicle way.... |
|
Back to top |
|
|
prabs2006
Active User
Joined: 12 Jan 2006 Posts: 103
|
|
|
|
Hi Krishnakanth,
You need to have a restart table to do this.If so,
I will take ur example only to explain this.
Give a commit say after a count of 10.This means for every 10 records ur changes will be commited.As soon as u commit, store the very next record in the restart table. This inserted row needs to be updated after every commit.
Suppose your program abends on 56th record, your 50 records would have been commited and 51st row would be in the restart table.
So when you restart the pgm,you have to fetch the restart table and start from there on.
I hope you understand this. I would also be interested to know if any other easy solution is available for this.
Thanks & regards
Prabs |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
Hi prabs,
what u told is correct. I think now with this krishnakanth doubt has been solved. |
|
Back to top |
|
|
prakash271082
New User
Joined: 09 Sep 2005 Posts: 53
|
|
|
|
Hi,
If you had Copied SQLCA in your WSS, you could check in SQLERRD field which would give you how many records ( Rows ) got updated.
Hope this helps. |
|
Back to top |
|
|
ragshere
New User
Joined: 20 Dec 2004 Posts: 70
|
|
|
|
hello Krishnakanth,
you told program updated 50 among 100 records. is it through single query? I mean when you run the query will it update 100 rows?
If it is the case, everything will be rolled back because of job abend.
If your program is updating each row at a time and job abended, the changes will be saved until latest commit point. changes after commit and before abend will be rolled back.
In this case your program has to be written such that it will fetch needed rows freshly and process.
I mean if it fetch the rows always when the program starts, data consistency will be maintained and no row processes 2 times. |
|
Back to top |
|
|
|