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 

Fetch, Write and Delete

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


Joined: 27 Aug 2007
Posts: 102
Topics: 42
Location: Chennai

PostPosted: Mon Feb 15, 2010 9:53 am    Post subject: Fetch, Write and Delete Reply with quote

We have a master table and around 10 child tables. What we do now is when a timestamp is passed to the program it fetches the parent row one by one, then fetches the equivalent child rows in all the tables, writes them to a file and deletes all the child rows and then the parent row at last.

Is there a way to do this more efficiently using UNLOAD, SORT, LOAD etc.

The way it is working now

Code:
1) Fetch row from master table
2) Write it to a master file
3) Fetch equivalent child row from child table 1.
4) Write it to a Chile file 1.
5) Delete this child row in child table 1.
6) Fetch equivalent child row from child table 2.
7) Write it to a Chile file 2.
8) Delete this child row in child table 2
.
.
.
Repeat the same process for all the 10 child tables
.
.
15) Delete the parent row
16) Repeat step 1

Did i make it clear? Please help

Thanks
_________________
Thanks
Back to top
View user's profile Send private message Yahoo Messenger
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Feb 15, 2010 11:28 am    Post subject: Reply with quote

edkir98,


Assuming the child tables are defined with DELETE CASCADE

1. Unload the Parent table and all the child tables
2. Reload the parent table with dummy.
3. Cascade delete will delete all the child table rows
4. Run a utility to remove the copy pending on parent and child tables

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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