Microsoft KB Archive/44357

REBUILD.EXE Does Not Change File Size, but Restructures Files

PSS ID Number: Q44357 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: When the COBOL Version 3.0 or 3.0a REBUILD.EXE utility reorganizes an ISAM file, it does not reclaim the space for deleted records. In other words, an input file for REBUILD.EXE that contains deleted records is not smaller after it has been rebuilt. The REBUILD utility restructures COBOL files in the following manner. During the rebuild process, REBUILD moves all retained records to the beginning of the file and all records flagged for deletion to the end of the file. If the REBUILD process is successful, space that was occupied by deleted records is made available for new records. When new records are added to the rebuilt file, they are written over the deleted records. This is not a problem with the REBUILD utility, but it is the way REBUILD was designed to function. You cannot reduce a COBOL file’s size with the REBUILD utility. The only workaround to reclaim the space for deleted records is to write a COBOL program that sequentially (ACCESS IS SEQUENTIAL) reads the existing file and writes it to a new file. Since deleted records are skipped, only currently existing records are transferred to the new file, and the resulting file will be smaller in size.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.