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
 

 

DB2 load for a table

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

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Fri Nov 15, 2013 7:13 pm    Post subject: DB2 load for a table
Reply with quote

Hi All,
I have a requirement to load a DB2 table (using the unload of the table from a previous date) using a batch job such that
1. The records from the table should be replaced with those from the
unload file
2. No other tables in the tablespace should be affected

I tried the below options with DSNUTILB but none seem to work for me
1. Replace - this deletes all the rows from other tables in the tablespace
2. Resume Yes - this adds up the records from the unload file to the table but does not delete the records in the table that are not in the unload file
3. Resume No (Default) - this does not work as the tablespace is not empty

Could any one suggest if this is possible and if so how. Thanks in advance.
Back to top
View user's profile Send private message

Pandora-Box

Moderator


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

PostPosted: Fri Nov 15, 2013 7:36 pm    Post subject:
Reply with quote

1.How many records you wanted to load ?
2.How many records are in table?
3.How many tables are there in the tablespace?
4.Is there a extract of other tables in the tablespace?
5.What version of db2 are you using?
Back to top
View user's profile Send private message
Vivek Anand

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Fri Nov 15, 2013 8:26 pm    Post subject:
Reply with quote

Pandora-Box wrote:
1.How many records you wanted to load ?
2.How many records are in table?
3.How many tables are there in the tablespace?
4.Is there a extract of other tables in the tablespace?
5.What version of db2 are you using?


Hi,
The number of records in the table and that i wanted to load can vary. Same is the case with the number of tables in the tablespace. Not sure how that would impact the processing. I am using DB2V7 for the current test.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Fri Nov 15, 2013 9:04 pm    Post subject:
Reply with quote

one way is to
- truncate the table beforehand
- Load resume yes.

another is to
- unload all tables in the tablespace except the forementioned table.
- Load Replace the concatenated files
Back to top
View user's profile Send private message
Vivek Anand

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Sun Nov 17, 2013 9:19 am    Post subject: Reply to: DB2 load for a table
Reply with quote

GuyC,
Thanks for your valuable inputs.
Back to top
View user's profile Send private message
Vivek Anand

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Mon Nov 18, 2013 6:52 pm    Post subject: Reply to: DB2 load for a table
Reply with quote

Hi GuyC/All,
I am faced with another challenge here. Suppose i use a delete query to clean up the table under question (before load) it might delete rows from other tables as well due to referential constraint. Is there a way i can ensure the constraint is not enforced while deleting rows from a table?
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Mon Nov 18, 2013 7:51 pm    Post subject:
Reply with quote

Hello,

Suggest you reconsider your approach . . .

If the constraints are needed, they should probably Not be bypassed.
Back to top
View user's profile Send private message
Vivek Anand

New User


Joined: 04 Jun 2013
Posts: 19
Location: India

PostPosted: Mon Nov 18, 2013 9:19 pm    Post subject: Reply to: DB2 load for a table
Reply with quote

Hi,
This should not be a problem as the tables might be out of sync only for a brief period of time. After that, i will revert back the table contents to what it was before the load and they will become consistent again.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Tue Nov 19, 2013 1:47 pm    Post subject:
Reply with quote

that's why I said truncate. It's not allowed when there is R.I.
Although it is not advisable you could drop the foreign key, do your thing and then recreate the foreign key. I 've seen processes who do this, but the problems are numerous and sometimes hard to solve.

In case of R.I. the second method is safer. although usually more CPU/Elapsed/space requirements.
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 Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
This topic is locked: you cannot edit posts or make replies. ERROR WHILE SUBMITTING LOAD JOB ANURADHA NEELAKANTAN JCL & VSAM 12 Thu Aug 25, 2016 11:50 am
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm


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