Offline reorganization by using the reorganization utilities

If you do not use the Utility Control Facility (UCF), reorganization of a database is done using a combination of utilities. Which utilities you need to use, and how many, depends on the type of database and whether it uses logical relationships or secondary indexes.

If your database does not use logical relationships or secondary indexes, you simply run the appropriate unload and reload utilities, which are as follows:

  • For HISAM databases, the HISAM Reorganization Unload utility and the HISAM Reorganization Reload utility
  • For HIDAM index databases (if reorganized separately from the HIDAM database), the HISAM Reorganization Unload utility and the HISAM Reorganization Reload utility
  • For SHISAM, HDAM, and HIDAM databases, the HD Reorganization Unload utility and the HD Reorganization Reload utility

If your database does use logical relationships or secondary indexes, you need to run the HD Reorganization Unload and Reload utilities (even if it is a HISAM database). In addition, you must run a variety of other utilities to collect, sort, and restore pointer information from a segment's prefix. Remember, when a database is reorganized, the location of segments changes. If logical relationships or secondary indexes are used, update prefixes to reflect new segment locations. The various utilities involved in updating segment prefixes are:

  • Database Prereorganization utility
  • Database Scan utility
  • Database Prefix Resolution utility
  • Database Prefix Update utility

These utilities can also be used to resolve prefix information during initial load of the database.

In the discussion of the utilities in this section, the four unload and reload utilities are discussed first. The four utilities used to resolve prefix information are then discussed. When reading through the utilities for the first time, you need to understand that, if logical relationships or secondary indexes exist (requiring use of the latter four utilities), the sequence in which operations is as follows:

Procedure

  1. Unload
  2. Collect more prefix information
  3. Reload
  4. Collect more prefix information
  5. Updated prefixes

You will find, for instance, that the HD Reorganization Reload utility does not just reload the database if a secondary index or logical relationship exists. It reloads the database using one input as a data set containing some of the prefix information that has been collected. It then produces a data set containing more prefix information as output from the reload. When the various utilities do their processing, they use data sets produced by previously executed utilities and produce data sets for use by subsequently executed utilities. When reading through the utilities, watch the input and output data set names, to understand what is happening.

The following figure shows you the sequence in which utilities are executed if logical relationships or secondary indexes exist.

Figure 1. Steps in reorganizing when logical relationships or secondary indexes exist
Utility order: HD Unload. Pre reorganization. Scan (optional). HD Reload. Prefix Resolution. If secondary indexes, HISAM Unload and HISAM Reload. If logical relationships, Prefix Update.

The following figure shows the sequence for these utilities when using HALDB partitions.

Figure 2. Steps for reorganizing HALDB partitions when logical relationships or secondary indexes exist
Figure depicts a flow chart: start, run HD Unload utility, if partition definitions have changed, run prereorganization, if they have not, run HD Reload utility, end

As an alternative, where above figure calls for the Partition Initialization utility, you can run the Prereorganization utility.