Chapter 14: Rebuilding Indexed Files

This chapter describes the Fix File Index utility that Mainframe Express provides for repairing corrupt indexed files on your PC.

For detailed information about using Fix File Index, see the Mainframe Express online . (Click Help Topics on the Help menu. Then, on the Contents tab, double-click Development Environment, Working with Data Files, Repairing Indexed Files.)

14.1 Overview

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.


Warnings:


14.2 Prerequisites

Fix File Index can rebuild only those indexed files that are already in Micro Focus format, which is the format used by Mainframe 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.

14.3 Rebuilding an Indexed File

This section describes how to rebuild a PC-style indexed file. To find out how to repair a mainframe-style indexed file, see the section Rebuilding a Mainframe-Style 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:

A screen dump of the Fix File Index dialog box

Figure 14-1: The Fix File Index Dialog Box (PC-style File)

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.

14.3.1 Rebuilding a Mainframe-Style Indexed File

To rebuild a corrupt mainframe-style indexed data file, you need to be working in catalog view. You can do this by clicking Data Tools on the Options menu, checking Use catalog and clicking OK. Then, you can open the project containing the corrupt indexed file and click the Catalog tab.

Make sure that the corrupt indexed data file is not already open. Then, from the Catalog View, you should highlight the name of the corrupt indexed data file and click Data Tools>Fix File Index on the Tools menu.

Fix File Index opens:

A screen dump of the Fix File Index dialog box

Figure 14-2: The Fix File Index Dialog Box (Mainframe-style File)

You can use DS name to type in the name of the corrupt indexed data file.

In the Fix File Index dialog box, DS name displays the name of the corrupt indexed data file.

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.

If the file header information is available, you can recreate the index file by clicking Fix File Index.

If the file header information is not available, Fix File Index displays a warning message. The catalog keeps a record of the file format but does not keep any key information. As Fix File cannot derive the key information from either the file header or the catalog, you need to enter the key information by clicking Define Keys. For more information, see the section Redefining Key Information.

14.3.2 Supplying File Header Information

To supply a file header, click Advanced Options on the Fix File Index dialog box.

The Advanced dialog box opens:

A screen dump of the Advanced dialog box

Figure 14-3: 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. If you specify either a C-ISAM or LEVEL-II file format, then you must also specify the record length.

If the index (.idx) file is missing, then you must specify the record length.

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.

14.3.3 Redefining Key Information

When you click Define Keys, the Key Information dialog box opens:

A screen dump of the Key Information dialog box

Figure 14-4: The Key Information Dialog Box (PC-style File)

If the file you are repairing is a mainframe-style file, the following dialog box opens:

A screen dump of the Key Information dialog box

Figure 14-5: The Key Information Dialog Box (Mainframe-style File)

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:

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.

14.4 Reorganizing Indexed Files

You should reorganize an indexed file after you have:

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 © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.