The copying phase for HALDB Online Reorganization
During the copying phase of a HALDB online reorganization, the HALDB partition comprises the A-through-J (and X) data sets and the M-through-V (and Y) data sets and both sets of data sets must be available in order for IMS applications to access the partition.
While IMS reorganizes a HALDB partition online, IMS applications can make database updates to the partition. Some of the database updates are made to the input data sets, while others are made to the output data sets, depending on which data is updated by the application. Which data sets are updated is transparent to the application program. The following figure illustrates the relationship between the input and output data sets at a point during the online reorganization.

The previous figure shows two sets of database data sets for a HALDB partition, the input data sets that have not been reorganized and the output data sets that have been (at least partially) reorganized. The figure shows the reorganization as progressing from left to right, from the input data sets above to the output data sets below. The data sets in the figure are divided into four areas:
- Data within the input data sets that has been copied to the output data sets. This area reflects the old data organization (prior to the reorganization), and is not used again by IMS applications until the data sets are reused as the output data sets for a later online reorganization.
- Data within the output data sets that has been copied from the input data sets. This data in this area has been reorganized, and can be used by IMS applications during the reorganization.
- Data within both the input and output data sets that is locked
and in the process of being copied and reorganized from the input
data sets to the output data sets. This area of locked records is
called a unit of reorganization. From a recovery point of view,
this unit of reorganization is equivalent to a unit of recovery.
While IMS processes the current unit of reorganization, IMS applications that access any of the locked data records must wait until IMS completes the reorganization for those records. After the copying and reorganization completes for the unit of reorganization, IMS commits the changes and unlocks the records, thus making them available again for IMS applications.
- Data within the input data sets that has not yet been copied to the output data sets. This data has also not yet been reorganized, and can be used by IMS applications during the reorganization.
As the online reorganization progresses, IMS uses a kind of pointer called a cursor to mark the end point of those database records that have already been copied from the input data sets to the output data sets. As the reorganization and copying proceeds, this cursor moves through the partition (from left to right in the preceding figure).
- From the output data sets if the database record is located
at or before
the cursor. - From the input data sets if the database record is located
after
the cursor.
To allow recovery of either an input data set or an output data set, all database changes are logged during the online reorganization, including the database records that are copied from the input data set to the output data sets.