A file-selection panel pops up. Select the files you wish to re-index, then click the Reindex
button. This pops up the Reindex - Rebuild database indexes panel. The panel is divided into the tab pages
Reindex selector and Options.
Reindex selector
This tab page shows a list of each selected file and its indexes. The indexes to be sorted can be
selected by clicking their check boxes in the list. There are buttons for selecting indexes for
the current selected file (row-selection buttons) and for all files (table-selection buttons).
There are separate buttons for selecting the on-line or batch indexes as groups.
The sort can be started by clicking the Reindex button or F2.
Options
On this tab page, there is a checkbox for detecting bad records. If this is checked, then you have
the following choices for what to do when invalid data is detected.
Invalid Data
Write to .BAD file for cleanup.
You can specify that when you re-index, a file will be created to contain the data from records
containing bad index data. It has the same root name as the data file being re-indexed, and the
extension .BAD.
Abort rebuilding indexes
Select this if you want the re-index process to be aborted in the event records are found
containing bad data.
Overwrite data with space/zeroes
Select this if you want any record with bad data to be retained but fields with bad data to be
emptied (filled with spaces or zeroed as appropriate to the type of the field).
Duplicate Records
There is also a checkbox for what to do if duplicate records are detected. If duplicate records
are found with the same data in the fields making up the index, obviously something is wrong. The
index may have been set to batch before data entry, or it may have been corrupted by a power failure,
or there may some other cause.
(TOP)
Cleanup
If duplicate records are found in a re-index process with the same data in fields which should
have unique values in every record, a file containing details of those duplicate records can be
requested. This option uses that file (which has the same root name as the data file and the
extension .BAD) to allow you to point and select the record to be kept, and to delete all the
other duplicates.
To initiate the cleaning process, select Cleanup from the Maintenance pulldown menu. This pops up
a file-selection panel.
First, the files to clean up must be selected. Provided there are duplicate records in
a .BAD file in the current directory for that file, you will see a screen with four boxes: Select
record to keep, Record to Keep, Current Record and Delete status (if the .BAD file does not exist,
you will see an error message).
The record numbers of the first set of duplicate records are shown in the Select record to keep
list and the first of those record numbers is marked (meaning it is the present Record To Keep).
Its number is noted in the form labeled Keeping:, and details of its fields are displayed in the
Record To Keep box. The total number of duplicate records in that set are noted in the form labeled Duplicates:.
The selection cursor starts out on the record number of the first duplicate (the next record with
the same key data). Details of its fields are displayed in the Current Record panel.
If there are too many fields to display at once, you can press the PGUP and PGDN keys to scroll
the record panel displays.
As you move the selection cursor down the list of duplicates, the Current Record panel changes
to reflect the details of the record under the cursor, but the Mark doesn't move. To select a
different record as the Record To Keep, move the selection cursor to its record number in the
Select Records to Keep column and press SPACEBAR. That record number will be marked, and the
Record To Keep panel will change to contain the details for that record.
Click OK to start the deletion process for the current duplicates, and all the duplicates
except the one marked as the Record To Keep will be deleted. The same routine will be repeated for
the next record that has any duplicates, so you may continue with this process until all the
duplicates in the file have been deleted.
Click Skip to skip the current set of duplicates, without deleting any of them, and move to the
next.
Click Auto to automatically delete all but the first record in all sets of duplicates.
Click Exit to exit the cleanup function.
If the process has not been completed (a record in the .BAD file still has a duplicate), you will
see a warning message that the file is unusable until the process is completed.
When Cleanup has finished, the .BAD file is deleted.
(TOP)
Repair
Under certain circumstances, a program crash can cause the header portion of your data files to
become corrupted. File-header corruption can cause further damage to your data and indexes and
must be addressed.
If header-integrity checking is enabled in a data file's parameters , then Visual DataFlex will
display an error message and stop the application from accessing the file while it is corrupted.
Database Builder can repair corrupted file headers provided header-integrity checking is enabled
in a data file's parameters. To start a repair operation, select Repair from the Maintenance
pulldown menu, select the files that you wish to perform a repair operation upon and click the
Repair button.
Where possible, each file is repaired. If a file needs no repair, you will see a message to that
effect. If an .HDR file cannot be found, or if header-integrity checking is not enabled for a file,
you will see a message to that effect, and nothing is done to that file.
When you elect to repair a data file, its header is subjected to two separate CRCs (Cyclic
Redundancy Checks), and the results are compared with CRC numbers maintained in the header. If one
or both checks fail, the repair process is started.
(TOP)