Example of Reorganizing an Indexed File

Note: On UNIX systems, Rebuild options must be preceded by a hyphen (-) character rather than a slash (/) character.

Example 1

rebuild infile.dat,outfile.dat

To reorganize the file, Rebuild reads the data file (infile.dat) using the index file (infile.idx) and then creates the output file (outfile.dat). The deleted records in infile.dat are not written to the output file.

Example 2

rebuild infile.dat,outfile.dat /i

In addition to reorganizing the file, Rebuild displays processing information when the reorganization is complete.

Example 3

rebuild infile.dat,outfile.dat /s:lii /t:lii

Reorganizes a LEVEL II V2.5 COBOL format file and retains the LII structure on the output file. It is possible to combine /s and /t with other formats in a similar manner.

Example 4

set data=\tmp.dat
rebuild data /i

Rebuild reorganizes and displays information about the file \tmp.dat.

Example 5

rebuild infile001.dat,outfile.dat/x:3

In addition to reorganizing the file, Rebuild writes the data in the order of the third alternate key.

Note: You cannot use the same filename for the input file and the output file.