PreviousUsing Record Layouts with Data Files Compatibility with the Mainframe EnvironmentNext"

Chapter 14: Rebuilding Corrupt 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 help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Development Environment, Working with Data Files, Repairing Indexed Files.)


Note: Before using Fix File Index, you should read the guidelines listed in the section Guidelines for Using Fix File Index.


14.1 Overview

The Fix File Index is available in graphical or command line form. Use the Fix File Index utility to:

Fix File Index Function
Comand Line Available?
Graphical Version Available?
Convert LEVEL-II V2.5 COBOL files into Micro Focus format so that they can be rebuilt if they become corrupt. Yes. See the section Converting a File Yes. Use the Data File Converter. See the chapter Converting Data Files
Rebuild a corrupt indexed file. Yes. See the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.) Yes. See the section Rebuilding a Corrupt Indexed File
Rebuild a corrupted catalog. Yes. See the section Rebuilding a Corrupted Catalog. No
Validate an indexed file. Yes. See the section Validating an Indexed File No
Reorganize an indexed file. Yes. See the section Reorganizing Indexed Files Yes. Use the Data File Converter. See the chapter Converting Data Files

14.1.1 Guidelines for Using Fix File Index

Before using Fix File Index, you should read the following guidelines:

14.1.2 Error Messages

The Mainframe Express online help contains full details of the error, information and warning messages that Fix File Index outputs. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Development Environment, Error Messages, Fix File Index Error Messages.)

14.2 Converting a File

Fix File Index can rebuild only those indexed files that are already in Micro Focus format, which is the format used by Mainframe Express.

You can use Fix File Index to convert LEVEL-II V2.5 COBOL files into Micro Focus format, so that they can be rebuilt in the event of corruption. Alternatively, use the Data File Converter (see the chapter Converting Data Files).

The format of the Fix File Index command line for converting a file is:

fixfile in-file,out-file [/s]
[/o] [/r] [/t] [/k] [/c] [/i] [/v]

You can use the Fix File Index command line to convert to and from any file organization. For more information about the command line, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)

14.3 Rebuilding a Corrupt Indexed File

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 in these circumstances:


Notes:


14.3.1 Mainframe-style files

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, open the project containing the corrupt indexed file and click the Catalog tab.


Note: The GUI version of Fix File Index does not support IDXFORMAT 8 files. To build the index of a file of IDXFORMAT 8 format, use Fix File Index from the command line. Information about the command line version is in the Mainframe Express online help, rather than in this chapter. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)


Make sure that the corrupt indexed data file is not already open. From the Catalog View, you should highlight the name of the corrupt indexed data file and click Data Tools>Fix FILENAME.DAT index on the Tools menu, where FILENAME.DAT is the name of the corrupt indexed data file.

Fix File Index opens:



Figure 14-1: Fix File Index (mainframe-style file)

Fix File Index displays the name of the corrupt indexed data file under DS name.

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 now 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.

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



Figure 14-2: 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.

The index file may have more than one key defined. 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, click OK. Then, click Fix File Index to repair the corrupt index file.

14.3.2 PC-style files

To rebuild the index of a corrupt indexed file, 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.


Note: The GUI version of Fix File Index does not support IDXFORMAT 8 files. To build the index of a file of IDXFORMAT 8 format, use Fix File Index from the command line. Information about the command line version is in the Mainframe Express online help, rather than in this chapter. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)


The Fix File Index dialog box opens:



Figure 14-3: Fix File Index (PC-style file)

Type in the name of the corrupt indexed file or click Browse to select the file.

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

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. To do so, click Advanced Options.

The Advanced dialog box opens:



Figure 14-4: The Advanced Options dialog box (PC-style file)

If the file format information is corrupt, the Select a File Format field displays 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.

The Key Information dialog box opens:



Figure 14-5: The Key Information dialog box (PC-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 FixFile Index.

Otherwise, click on 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 can have more than one component. To insert another component, highlight a component in the tree and click either Insert Component Before or Insert Component After.

The index file can have more than one key defined. 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, click OK. Then, you can click Fix File Index to repair the corrupt index file.

14.4 Rebuilding a Corrupted Catalog

It is unlikely that a catalog is corrupted, but this may happen as a result of a power or system failure. If a catalog is corrupt, use the following Fix File Index command line to rebuild the catalog with the correct compression attributes:

fixfile catalog.dat,fixed.dat /s:mf8 /t:mf8 /i /k:1+52,53+260
/r:V476-10476 /d /c:d1i4

For more information about the command line, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)

14.5 Validating an Indexed File

You can use Fix File Index to validate the structure of an indexed file. The format of the command line for validating a file is:

fixfile in-file /f[c] [d]

For more information about the command line, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)

14.6 Reorganizing Indexed Files

As indexed files are updated by adding, deleting and altering records, the index and data structures become disjointed, making processing less efficient. In addition, space left by deleted records is not always reused, making the file bigger than it needs to be.

After making a large number of changes, you can reorganize an indexed file for optimum performance and data integrity. This rebuilds the data and indices in an ordered sequential fashion and reclaims any free space.

There are other reasons why you might want to rebuild a file. For example, if a file is processed sequentially, the access time to process the file increases over time as the records become out of sequence due to updates. In this situation, you can reduce access time by reorganizing the file.

The format of the Fix File Index command line for reorganizing a file is:

fixfile in-file,out-file [/c]
[/d {/k}] [/x] [/i] [/v]

For more information about the command line, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, Command Line Reference, Repairing Indexed Files.)


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



Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousUsing Record Layouts with Data Files Compatibility with the Mainframe EnvironmentNext"