Operation (cont.) [ Micro Focus COBOL System Reference, Volume 1 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 1
Operation (cont.)
fhrebuild Utility
The fhrebuild utility enables you to completely reindex a corrupt indexed
file. You need to supply details of all the indices you want to create.
You can use this utility with the fhvalidate utility to repair a corrupt
file.
To use this utility you need to construct a parameter file containing the
name and type of file you are using (note that the output file name will
have the same name as the file you want to reindex). The details of all
keys you want to include should also be given. You then invoke the
utility.
When using fhrebuild, you must always rebuild the file in the same format
as the original file for the following parameters:
* fixed or variable length file
* record length
* record delimiter
If you used fhvalidate first, and the validation resulted in a parameter
file being produced for use with fhrebuild, you can use this file as the
parameter file. In this case do not need to create an additional
parameter file.
fhrebuild, if successful, will replace the existing file with the
newly indexed file. However, this may not always be possible as
inconsistencies within the data file can render an indexed file incapable
of being rebuilt. If fhrebuild fails, the file will be left in the same
form as before using the utility and an appropriate error message given.
fhrebuild Parameter File Format.
The parameter file records are:
Parameter Parameter Description
Value Value
-----------------------------------------------------------
ON xxxxxxxxxx output file-name (length
is operating system
dependent)
OT xx output file type. File
types are:
I0 C-ISAM
I1 X/Open
I2 LEVEL II indexed
I3 Indexed files of the
format used by this
COBOL system
I4 IDXFORMAT"4" indexed
OF nnnn fixed record length in
bytes (n)
OV mmmm/nnnn variable record length,
minimum (m), maximum (n)
OB nnnn optional - index block
size 511, 1023 or 4095
OE optional - when
specified, .dat
extension for output
file not required
NL xxxx.... optional - NLS language
name
PK DSLTC primary key description
(m:n:xxx/m:n:xxx/...)
AK DSLTC optional - alternate key
(m:n:xxx/m:n:xxx/...) description, one for
each alternate key used
in file
DC nnn = optional - data
compression type (0
-255)
For more information on keys, see the section Use of Keys in Indexed
Files earlier in this chapter.
fhrebuild Error Handling.
If an error is detected, fhrebuild closes all files, then terminates,
displaying a message on the screen indicating the type of error detected.
All error messages returned by the File Handler utilities are listed in
alphabetical order in the appendix File Handler Utility Error Messages,
along with any other relevant information.
fhreorg Utility
The fhreorg utility enables you toreorganize an indexed file using any
record key. Using this method of file reorganization for the most common
key of access may improve record access performance.
To use this utility you need to create a parameter file holding
information on how you want to reorganize your indexed file, including
information about keys in the file. You then invoke the utility.
fhreorg Parameter File Format.
The parameter file records are:
Parameter Parameter Description
Value Value
-----------------------------------------------------------
IN xxxxxxxxxx input file-name (length
is operating system
dependent)
IE optional - when
specified, .dat
extension for input file
not required
IT xx input file type. File
types are:
I0 C-ISAM
I1 X/Open
I2 LEVEL II indexed
I3 Indexed files of the
format used by this
COBOL system
I4 IDXFORMAT"4" indexed
KN xxx key number of access key
\(1 = prime)
ON xxxxxxxxxx output file-name (length
is operating system
dependent)
OE optional - when
specified, .dat
extension for output
file not required
OT xx output file type. File
types are as for IN
parameter above
PK DSLTC (m:n:xxx/..) primary key description
for output file
AK DSLTC (m:n:xxx/..) optional - alternate key
descriptions for output
file
KO x record retrieval order:
0 = ascending order
1 = descending order
DC xxx optional - output file
data compression type
For more information on keys, see the section Use of Keys in Indexed
Files earlier in this chapter.
fhreorg Error Handling.
If an error is detected, the utility will close all files, then
terminate, displaying a message on the screen indicating the type of
error detected.
All error messages returned by the File Handler utilities are listed in
alphabetical order in the appendix File Handler Utility Error Messages,
along with any other relevant information.
fhreorg Restrictions.
You cannot reorder a selected portion of the file.
fhvalidate Utility
The fhvalidate utility enables you to inspect a file for
self-consistency. Once run you get a simple report indicating the
success or failure of the file inspection.
When using this utility with an indexed file, you obtain additional
information about corrupt indices. You can use this information directly
as a parameter file with the fhedit and fhrebuild to reindex the file.
You give the details of the file you want to inspect in the parameter
file (this information includes the type of file and the record length),
then invoke the utility. You will see various messages during and after
the validation, which are detailed in the section Validation Information
Messages.
When used with an indexed file, if the file is found to be inconsistent,
a parameter file is created for use with either fhedit or fhrebuild,
whichever is appropriate. This parameter file is directed to standard
output (stdout) unless you specify the -f flag on the File Handler
command line (see the section Command Line earlier in this chapter).
Note that if a parameter file is produced for use with the fhrebuild
utility, any inconsistencies within the data file may render the file
incapable of being rebuilt.
fhvalidate Parameter File Format.
When using fhvalidate, you do not need to enter the record length for
indexed files.
If your file uses data compression you must specify a file type of I3.
The parameter file records are:
Parameter Parameter Description
Value Value
------------------------------------------------------------
IN xxxxxxxxxx input file-name (length
is operating system
dependent)
IT xx input file type. File
types are:
I0 C-ISAM
I1 X/Open
I2 LEVEL II indexed
I3 Indexed files of the
format used by this
COBOL system
I4 IDXFORMAT"4" indexed
R0 Relative
S0 Sequential
L0 Line sequential
IE optional - when
specified, .dat
extension for indexed
input file not required
ID n optional - record
delimiter (omit for
indexed and sequential
files):
0 = LF (default)
1 = CR and LF
IF nnnn fixed record length in
bytes (not needed for
indexed files)
IV mmmm/nnnn variable record length
minimum (m), maximum (n)
(not needed for indexed
files)
Validation Information Messages.
File information messages associated only with fhvalidate are as follows:
# Cannot recover from previous error, quitting file validation
* The preceding reported error has resulted in an unsuccessful
completion of the validation.
# Error - Index entries inconsistent with records on data file
* The records in the data file do not fully correspond to the
information held in the index file, indicating the file is
inconsistent.
# Error detected on index nn, record nn. (iserrno = )
* The specified record in an indexed file has been found to be
inconsistent.
# Error detected on index nn. (iserrno = )
* The specified index has been found to be inconsistent.
# Error - Index record size incorrect
* The index block size is not equal to 511, 1023 or 4095. This
implies a problem with the index file.
# Error reading record nn in filename. (errno)
* The specified record in the named file is inconsistent.
# File needs to be edited. Creating parameter file for fhedit
* The utility has diagnosed the file can be best repaired by using
the fhedit utility. A parameter file is being constructed to use
with that utility.
# File needs to be rebuilt. Creating parameter file for fhrebuild
* The utility has diagnosed the file can be best repaired by using
the fhrebuild utility. A parameter file is being constructed to
use with that utility.
# Record length of record nn or record nn is inconsistent
* The length of the record is inconsistent with the specified length
of records in the file. This implies a problem with this record.
Validation of file was successful file-name
* This indicates that the named file inspected by the fhvalidate
utility has been found to be consistent.
Validation of file was unsuccessful file-name
* This indicates that the named file inspected by the fhvalidate
utility has been found to be inconsistent.
fhvalidate Error Handling.
fhvalidate gives the following warning message if you include the input
record size for indexed files:
(IF/IV) Record length is ignored for input ISAM file
You do not need to give this information as fhvalidate takes these
details from the file (you must include this information for other file
types). This is only a warning message. fhvalidate should run normally
unless an error situation is detected.
If you include a record delimiter in the parameter file for an indexed or
sequential file you will see one of the following warning messages:
Record delimiter has been specified for ISAM file
Record delimiter has been specified for sequential file
fhvalidate ignores the record delimiter as it is not applicable to
indexed or sequential files, and continues as normal.
If an error is detected, fhvalidate closes all files, then terminates,
displaying a message on the screen indicating the type of error detected.
All error messages returned by the File Handler utilities are listed in
alphabetical order in the appendix File Handler Utility Error Messages,
along with any other relevant information.
MPE/iX 5.0 Documentation