When a segment is deleted, the space it occupied is reused by the next segment inserted which is not larger than the deleted segment. However, if new segments are not inserted which 'fit' this deleted space, the space is not reclaimed until you reorganize the database. Also, as a database is updated, the internal pointers can become fragmented which reduces performance. A reorganization will restore the performance to that of a newly loaded database.
The Reorganize function combines the functions of the Load, Unload, PtrUpdate, and Delete functions to perform the reorganization. It creates the required steps using an advanced feature of the Makelist function. This Makelist feature is only available when using the callable API interface to IMSDBU. The interactive and command line interfaces for Makelist only support creating steps for loading databases. The callable interface adds the ability to create the steps for reorganizing databases.
The reorganization for a database with no logical children is simply to unload the database to a sequential file and load it using the sequential file.
Reorganizing a database containing logical children results in reorganizing it and all of its related databases. The steps to reorganize these databases are:
Identifying the related databases is done by Makelist. The process Makelist uses to create this list is the same for Reorganize as it is for Load.
The sequential unload files are not deleted until all of the Load and PtrUpdate processing is complete. Although this requires more disk space than deleting them after the Load, it provides for restarting if a subsequent Load or PtrUpdate step fails. If you need to conserve disk space, you can change the DBUREORG.RUN file to re-sequence the Delete commands and use Runlist to run the commands. You could also create your own Runlist command file or run the required functions in an operating system command file.
When the detailed report filename *.LST is used, a separate list file is created for each database involved in the reorganization. For a combined listing, specify the directives LIST(file-spec) and LISTOPEN(MOD).