MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 Update based on Count

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sakreg
Beginner


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Mon Jan 09, 2006 6:13 am    Post subject: DB2 Update based on Count Reply with quote

I have to update around 32,000 records in chunks of 5000 each. UPDATE Query at any time will fetch 32,000 records. But I need to update only the first 5,000. Is there a way to do this?
Back to top
View user's profile Send private message
CZerfas
Intermediate


Joined: 31 Jan 2003
Posts: 211
Topics: 8

PostPosted: Mon Jan 09, 2006 7:49 am    Post subject: Reply with quote

Since SQL is a set oriented language, this will only work, if you are able to formulate aditional predicates in the WHERE-clause, that give you chunks of 5000 rows.

regards
Christian
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Mon Jan 09, 2006 7:50 am    Post subject: Reply with quote

Sakreg,

1.Unload the 32,000 records.
2.Generate sqlcards for the first 5000 records using sort/fileaid
3.Run the update.

You can get the sample JCL's from this topic which was started by you

http://www.mvsforums.com/helpboards/viewtopic.php?p=20620#20620

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sakreg
Beginner


Joined: 28 Feb 2005
Posts: 80
Topics: 26

PostPosted: Mon Jan 09, 2006 9:22 am    Post subject: Reply with quote

CZerfas,
Thats what is making life more harder. I have chosen 5000 as ~ 5500 records can only be processed by the Task (which runs under IMS BMP and updates DB2 and the design is in a way that there is no Checkpoint). This is a very rare scenarion as the design is actually based on with few hundreds and that is what was happening so far.

I tried with many predicates, but that result varies and I am pushed to re-run the same task for about more than 20 time Sad

So I would be Smile if there is a way to control the number of records that are been updated in a single run giving me the exact count of records as expected

kolusu,
I can not do that way, as I would have to delete the rows after unloading and then load back with the required indicator for the task to process the allowed number of records.

So I am basically looking for a SQL that can limit the Update after it has reached some 5000 records, neglecting the rest (which also meets the same criteria for updation)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group