REORG

From BR Wiki
Revision as of 19:24, 22 July 2013 by Laura (talk | contribs) (Created page with "REORG is a parameter of the Index command, and can be used to reorganize index files directly, without reading the master file. This can greatly speed up the re-indexing p...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

REORG is a parameter of the Index command, and can be used to reorganize index files directly, without reading the master file. This can greatly speed up the re-indexing process, especially on network systems, because the already sorted portion of the index file will not be sorted again. If the index file has already been fully sorted, BR will read only the header record and then quit the re-indexing process immediately.

It is important to note that the REORG parameter will generally not cause new records to be added to the index file. It is the responsibility of the programmer to be sure that index file's overflow area is updated with added records before REORG performs its operation. This can be done by always opening the index file when writing to the master file.

There are three cases in which INDEX with the REORG parameter will completely build an index file:

  • When the index file does not exist.
  • When the specified file is not an index file.
  • When any of the key starting pos or key length parameters stored in the header record are different from those specified in the INDEX REORG command.