Page 1 of 1

Modify only the specific ROWs in DB2 table.

Posted: Mon Oct 07, 2024 12:30 pm
by LearnMainframe
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:
  1. Unload the entire table.
  2. Remove the rows that don’t need to be updated, keeping only the ones that require changes in the unloaded file.
  3. Make the necessary updates to the selected records. This does not alter the keys. 
  4. Reload the table using the modified file, ensuring that only the updated rows are affected.
Is there an option in the Load utility that supports this process? 

Re: Modify only the specific ROWs in DB2 table.

Posted: Mon Oct 07, 2024 7:24 pm
by zum13
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.

Re: Modify only the specific ROWs in DB2 table.

Posted: Tue Mar 24, 2026 12:56 pm
by LearnMainframe
Thanks. I used QMF to update the table. Thank you for your reply.