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
 

 

Loading a table records from another db2 table

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

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Tue Jun 17, 2008 12:41 pm    Post subject: Loading a table records from another db2 table
Reply with quote

Hi All,

I need to load a table with some records which is from another db2 table,
I am planing to do the same using an unload utility which will download the records for me and in the next step i will use a load utility to load to second table. I dont want all the columns and i will be specifying a condition so that i will get only the needed records.
Can any one tell me is this is the correct method to try or can i give a query in jcl which will select the rows based on the conditin and inserts to the table
a query some thng like
INSERT INTO TABLE1(SELECT * FROM TABLE2)

is there any drawbacks in the second approch ,

Thanks in advance
Back to top
View user's profile Send private message

Varun Singh

New User


Joined: 01 Aug 2007
Posts: 25
Location: Delhi

PostPosted: Tue Jun 17, 2008 1:20 pm    Post subject: Reply to: DB2 load
Reply with quote

I don't think the second approach will work as I do not know any utility which accepts subquery's
anyways what I will suggest you to stick to the first approach

First unload the records from DB2 tables with the concerned columns that you want and
then try loading them to a different table
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 17, 2008 1:53 pm    Post subject:
Reply with quote

you will need to modify the generated LOAD cards, found in the syspunch output of the unload job.
Back to top
View user's profile Send private message
am_ne

New User


Joined: 24 Mar 2007
Posts: 25
Location: Bangalore

PostPosted: Tue Jun 17, 2008 2:26 pm    Post subject:
Reply with quote

In addition to the above you have to specify HEADER option in unload card and it should be HEADER NONE.
Back to top
View user's profile Send private message
ascelepius

New User


Joined: 16 Jun 2008
Posts: 35
Location: bangalore

PostPosted: Tue Jun 17, 2008 3:47 pm    Post subject: Reply to: Loading a table records from another db2 table
Reply with quote

As most DBAs would say, your answer is "It Depends"!

Case A. If you are loading a small volume of data(say about 100-1000, which should be safe), I'd think- why go for the trouble of Unload and Load, running a simple

Code:

INSERT INTO TABLE1 (Col1, COl2...ColN) SELECT col1, Col2,..ColN from TABLE2 where ...


would do.

Case B. You have a hundred thousand records to insert, then you could follow the unload strategy, since too many DB2 resources get used up in Case A.

Hope this helps..

regards,
ASCI(I)
Back to top
View user's profile Send private message
rohanatl

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Tue Jun 17, 2008 4:45 pm    Post subject:
Reply with quote

Hi Thanks a lot for your quick response..
I will be having a huge amount of data to insert so i think i should follow the second option.
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts loading a Modified Mapset Susanta CICS 2 Tue Mar 14, 2017 5:43 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am


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