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

DB2 QUERY


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

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Feb 28, 2014 7:50 pm
Reply with quote

hI,

I have written a one time program to delete 2milion records from the table,
i am still not clear how to use checkpoint in the delete query program.

my program is having only delete query

thnks
siva
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Feb 28, 2014 7:58 pm
Reply with quote

Hello,

Suggest you unload the table, copy the "Keepers" to a new file. reload the table with the copied file.

This will run faster than a ton of deletes and gives you a backup of the entire table before the deetes (the unloaded data).

I would not consider any kind of checkpoint/restart.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Feb 28, 2014 8:00 pm
Reply with quote

Are you just doing a delete via cursor or delete via single sql or reading a file and deleting the data?

When you say checkpoint I assume you ment a check point for a commit and a restart
Back to top
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Feb 28, 2014 8:02 pm
Reply with quote

my DBA is not accepting to do the delete, they want to delete through the program only.
Back to top
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Fri Feb 28, 2014 8:05 pm
Reply with quote

i am reading a file and delete the records in a single query without using CURSOR.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Feb 28, 2014 8:18 pm
Reply with quote

Siva,

You could try Dick's solution and I feel it is the best as doing a load replace you could also take care of REORG + RUNSTATS

If you still insist an Application program

Take care of these things


- Set a optimal commit frequency (Talk to your DBA)
- Store your commit data in a restart table (if you have any) or use files for your program
- On beginning of program execution read the restart table and see if it normal run or restart run
- If restart run skip the number of records trhat were processed from file or skip based on the key.After succesful execution ensure to reset the flags/data in restart table for next run
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Sat Mar 01, 2014 12:53 pm
Reply with quote

Please refer to the below thread and a very informational document is attached by dick at the end which contains sample programs as well and this could be very easy for you to understand..

ibmmainframes.com/about7691.html
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