|Converting Data Files
|File Conversion Utilities
This chapter describes the Fix File Index utility that Net Express provides for repairing corrupt indexed files on your PC.
For detailed information about using Fix File Index, see the Net Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click Development Environment, Working with Data Files, Repairing Indexed Files.)
There are a number of reasons why an indexed file becomes corrupt. For example:
When a COBOL program tries to open a corrupt indexed file, the run time system detects that the file is corrupt and returns an extended file status code.
Fix File Index can recover corrupt indexed files for you under the following circumstances:
After you have used Fix File Index, you should reorganize the repaired file. For more information, see the section Reorganizing Indexed Files.
Otherwise, results may be unpredictable.
Fix File Index can rebuild only those indexed files that are already in Micro Focus format, which is the format used by Net Express. Therefore, initially you should convert your LEVEL-II V2.5 COBOL files into Micro Focus format, so that you can rebuild the files in the event of corruption. To convert your files, use the Data File Converter (see the chapter Converting Data Files).
Before you rebuild a file, you should take a backup copy of both the index (.idx) and data (.dat) parts of the indexed file.
To rebuild the index of a corrupt indexed file, you should make sure that the corrupt indexed file is not still open in the Data File Editor. Then, click Data Tools>Fix File Index on the Tools menu.
The Fix File Index dialog box opens:
Figure 14-1: The Fix File Index Dialog Box
You can type in the name of the corrupt indexed file or click Browse to select the file.
If the file header information is not available, Fix File Index displays a warning message. As Fix File cannot derive this information from the file header, you must select a file format and define the file keys. For more information, see the section Supplying File Header Information.
If the file header information is available, you can recreate the index file by clicking Fix File Index.
To supply a file header, click Advanced Options on the Fix File Index dialog box.
The Advanced dialog box opens:
Figure 14-2: Supplying the File Header Information
If the file format information is corrupt, Select a File Format displays as UNKNOWN. In this case, you need to specify the file format, which must be the same as the original file format of the index file before the file became corrupt.
You can ask Fix File Index to carry on processing, after finding a record with duplicate keys, by checking Continue after a duplicate key error?. In this case, Fix File Index reports any records with duplicate keys without writing those records.
You can check whether the key information is corrupt by clicking Define Keys.
When you click Define Keys, the Key Information dialog box opens:
Figure 14-3: The Key Information Dialog Box
If the Key Information dialog box displays the correct key information, the key information is not corrupt and you can click Cancel and then click FixFile Index to repair the file.
Otherwise, you can click Insert Key to add the first key. At this point, the tree expands and the cursor moves to Key Offset. For each key that you add, you need to supply the following information:
For each key, you can supply additional information under Key Compression and Key Options, where relevant.
The tree structure displays key components as child items. A key may have more than one component. To insert another component, you can highlight a component in the tree and then click on either Insert Component Before or Insert Component After.
You can define more than one key for the index file. To insert another key, highlight a key in the tree and then click on either Insert Key Before or Insert Key After.
When you have finished, you can click OK. Then, to repair the corrupt index file, click Fix File Index in the Fix File Index dialog box.
You should reorganize an indexed file after you have:
The information held in the original index about free space in the data file is lost. Since you cannot reuse the free space in the data file, the file may be bigger than is necessary.
When you add, delete and modify records, the index and data structures can become disjointed. This makes processing less efficient. In addition, space left by deleted records is not always re-used, making the file larger than it needs to be.
To overcome this problem, you should reorganize the indexed file for optimum performance and data integrity. This rebuilds the data and indices in an ordered sequential fashion and reclaims any free space.
The access time to process the file increases over time as the records become out of sequence due to updates.You can reduce access time by reorganizing the file.
To reorganize an indexed file, use the Data File Converter and specify the same output file and format as the input file. To find out more about the Data File Converter, see the chapter Converting Data Files.
Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
|Converting Data Files
|File Conversion Utilities