IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

a query on DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
krishnakanth
Warnings : 1

New User


Joined: 01 Feb 2006
Posts: 3

PostPosted: Mon Feb 06, 2006 3:18 pm
Reply with quote

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
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 3:30 pm
Reply with quote

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
View user's profile Send private message
krishnakanth
Warnings : 1

New User


Joined: 01 Feb 2006
Posts: 3

PostPosted: Mon Feb 06, 2006 3:40 pm
Reply with quote

Hi Nuthan,

Can u pls explain this in more practicle way....
Back to top
View user's profile Send private message
prabs2006

Active User


Joined: 12 Jan 2006
Posts: 103

PostPosted: Mon Feb 06, 2006 3:41 pm
Reply with quote

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
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 4:12 pm
Reply with quote

Hi prabs,
what u told is correct. I think now with this krishnakanth doubt has been solved.
Back to top
View user's profile Send private message
prakash271082

New User


Joined: 09 Sep 2005
Posts: 53

PostPosted: Mon Feb 06, 2006 4:46 pm
Reply with quote

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
View user's profile Send private message
ragshere

New User


Joined: 20 Dec 2004
Posts: 70

PostPosted: Wed Feb 08, 2006 4:09 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
No new posts Issue with EXEC CICS QUERY SECURITY c... CICS 6
Search our Forums:

Back to Top