Usage notes: Reorganize a file

Here is a list of considerations for reorganizing a file.

  1. If a file with an arrival sequence access path is reorganized using a keyed sequence access path, the arrival sequence access path is changed. That is, the records in the file are physically placed in the order of the keyed sequence access path used. By reorganizing the data into a physical sequence that closely matches the keyed access path you are using, you can improve the performance of processing the data sequentially.
  2. Reorganizing a file compresses deleted records, which changes subsequent relative record numbers.
  3. Because access paths with either the first-changed-first-out (FCFO), first-in-first-out (FIFO), or last-in-first-out (LIFO) DDS keyword specified depend on the physical sequence of records in the physical file, the sequence of the records with duplicate key fields might change after reorganizing a physical file using a keyed sequence access path. The sequence of the records with duplicate key fields are maintained only for the access path specified in the KEYFILE parameter. If the access path specified in the KEYFILE parameter has a LIFO DDS keyword, the duplicate key fields are maintained only if you specify that the reorganize operation can be canceled (suspended).
  4. If you specify that the reorganize operation cannot be canceled and you end the job running the Reorganize Physical File Member (RGZPFM) command, all the access paths over the physical file member might have to be rebuilt. If you specify that the reorganize operation can be canceled, and you cancel the RGZPFM command, only those access paths that are not maintained during the reorganize operation might have to be rebuilt.
  5. If you use the RGZPFM command twice in a row, you might notice that the total size of the file after the first time differs from the total size after the second. This is because the amount of space allocated for the reorganized file is only an estimate that allows extra space for future insertion. After records are reorganized the first time, the space allocated is calculated exactly.