- Unload the entire table.
- Remove the rows that don’t need to be updated, keeping only the ones that require changes in the unloaded file.
- Make the necessary updates to the selected records. This does not alter the keys.
- Reload the table using the modified file, ensuring that only the updated rows are affected.
Modify only the specific ROWs in DB2 table.
-
LearnMainframe
- Registered Member
- Posts: 36
- Joined: Fri Jul 05, 2013 11:52 am
Modify only the specific ROWs in DB2 table.
Hello,Keeping in mind that LOAD REPLACE overwrites the entire table, and LOAD RESUME appends the data. Keeping this in mind, consider the scenario:Imagine a table with 100 rows, and I need to update 30 of them. My approach:
Re: Modify only the specific ROWs in DB2 table.
The manual states: "If the table space already contains data, you can choose whether you want to add the new data to the existing data or replace the existing data." What you are attempting to do is partially replace the data. As far as I'm aware, the LOAD utility does not do that. You'd have to delete the rows you are replacing before loading the copied rows as added data. The alternative is to unload the table, edit the required rows (without removing the ones you're not updating), then reload the table replacing the existing rows.
Given that you are only updating 30 rows and that what you have described has all the hallmarks of a one-off corrective process, it may just be quicker and easier to use the UPDATE statement or use an editor utility. QMF has a feature for editing tables, as does IBM's File Manager/DB2 and Compuware's FileAid for DB2.
Given that you are only updating 30 rows and that what you have described has all the hallmarks of a one-off corrective process, it may just be quicker and easier to use the UPDATE statement or use an editor utility. QMF has a feature for editing tables, as does IBM's File Manager/DB2 and Compuware's FileAid for DB2.
-
LearnMainframe
- Registered Member
- Posts: 36
- Joined: Fri Jul 05, 2013 11:52 am
Re: Modify only the specific ROWs in DB2 table.
Thanks. I used QMF to update the table. Thank you for your reply.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute