Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Load a new table from data of 2 tables

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Anney

New User


Joined: 06 Jan 2007
Posts: 7
Location: Chennai

PostPosted: Mon Jun 18, 2007 2:49 pm    Post subject: Load a new table from data of 2 tables
Reply with quote

Hi,

I have got 2 tables, one partition and other normal. I have to create a new table (partition) with rows from the two tables after a join subquery. There are certain colums which I need to update in the new table. Could any one tell me if the below steps are fine? Or is there a better way to do this.

1. Create a temporary view for the join of 2 tables for each partition of the first table
2. Unload the data to a sequential file
3. Make changes to the sequential file
4. Load it to the new table for each partiton of the first table

Thanks,
Anney
Back to top
View user's profile Send private message

mkk157

Active User


Joined: 17 May 2006
Posts: 310

PostPosted: Mon Jun 18, 2007 5:20 pm    Post subject: hi
Reply with quote

Hi Anney,

The steps for ur requirement are fine. Just continue with those steps, and let us know if u face any problem in between the processing.
Back to top
View user's profile Send private message
Anney

New User


Joined: 06 Jan 2007
Posts: 7
Location: Chennai

PostPosted: Tue Jun 19, 2007 12:12 pm    Post subject: Thanks
Reply with quote

Thanks M K K. I will get back.


Thanks,
Anney
Back to top
View user's profile Send private message
Suryanarayana.tadala

New User


Joined: 03 Nov 2005
Posts: 43
Location: St.Louis

PostPosted: Sat Jun 23, 2007 1:45 am    Post subject:
Reply with quote

Any update Anney !!!
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sat Jun 23, 2007 7:13 am    Post subject:
Reply with quote

Doesn't DB2 handles the Insert into TABLE SELECT ..... FROM table A, Table B? Without going through an unload/reload cycle?
Back to top
View user's profile Send private message
Johnson_Jiang

New User


Joined: 05 Apr 2007
Posts: 11
Location: China,ShenZhen

PostPosted: Thu Jun 28, 2007 12:36 pm    Post subject: Agree with stodolas!
Reply with quote

Use 'INSERT INTO <new table> SELECT xxxx... FROM tb1, tb2 ... can simplify this process, one SQL statement is enough!
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Thu Jun 28, 2007 4:31 pm    Post subject:
Reply with quote

well, look at the amount of data. If it is of huge data then UNLOAD & LOAD will be best than INSERT into table select...

I dont think you have to create a View firstly. Just put the view DDL in the unload input. It would get the data for you in the flat file.

As per my understanding its not a good idea to edit the data in the unload file. ( As per your step: Make changes to the sequential file ). Do a load on to the new table and use SQL to make whatever the changes you want to do. It would be easy for you and its a preffered method.
Back to top
View user's profile Send private message
Anney

New User


Joined: 06 Jan 2007
Posts: 7
Location: Chennai

PostPosted: Sat Nov 03, 2007 8:26 am    Post subject: Reply to: Load a new table from data of 2 tables
Reply with quote

Many Thanks All,

It took a while for me to work on this. This is what I did at the end.

1.Unloaded the first and second tables into 2 separate sequential files. This was done part by part.
2. Then the two files were joined using SYNCSORT Join with a common key to a third file
3. Load append this third file to the new table for each partiton (similary partitioned as the first table)

Thanks,
Anney
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 4 Sun Jan 22, 2017 11:32 pm
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 1 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us