Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1542
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: 1281
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: 1281
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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Adding a userid to SMTP Security table Yolanda Harvey JCL & VSAM 1 Sun Aug 13, 2017 6:16 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us