Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ fhutil(8:4:CHARTYPE) — Micro Focus Object COBOL 4.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

   ========================================================================
                           M I C R O    F O C U S

           O P E R A T I N G   S Y S T E M   E X T E N S I O N S

                                   V4.1.10

   ========================================================================

                          FILE HANDLER UTILITIES
                          ======================

   This document describes the File Handler utilities supplied with Micro
   Focus OSX to enable you to port files between Micro Focus COBOL systems
   for UNIX and Micro Focus COBOL systems for DOS, Windows, Windows NT,
   Windows 95 and OS/2; and to maintain these files after porting.


   TABLE OF CONTENTS
   ==================
       OVERVIEW
       OPERATION
           Invoking the File Handler Utilities
           File Types Supported by the File Handler Utilities
           Default File Type Parameters
           Default Index Block Size
           Use of Keys in Indexed Files
           Error Handling
           Error Conditions
           Creating Statically Linked Executable Files
           fhconvert Utility
           fhcreate Utility
           fhedit Utility
           fhinfo Utility
           fhrebuild Utility
           fhreorg Utility
           fhvalidate Utility
       FILE HANDLER UTILITY ERROR MESSAGES
           Utility Error Messages
           File-specific Error Codes
           Errors for Remaining File Types


   OVERVIEW
   ========
   The File Handler utilities are a suite of programs provided with this
   COBOL system that you use to manage your files. No programming language
   is required to use the utilities, but you need to use an editor to
   construct a parameter file that you then use to enter information into
   the utility programs.

   There are seven different file handler utilities. Two of these work with
   all recognized file types:

   -------------------------------------------------------------------------
   Utility                     Description
   -------------------------------------------------------------------------
   fhconvert             converts an existing file into a different type of
                         file

   fhvalidate            inspects a file for consistency


   The other five utilities work only with indexed files:

   -------------------------------------------------------------------------
   Utility                     Description
   -------------------------------------------------------------------------
   fhcreate              builds an empty indexed file

   fhedit                adds and deletes indices

   fhinfo                accesses file and index information

   fhrebuild             reindexes a corrupt file

   fhreorg               reorganizes an indexed file


   This chapter shows you how to invoke the utilities and gives the type of
   files supported by the File Handler utilities and the default file type
   parameters, the default indexed block size of the utilities, the use of
   keys in indexed files, and error conditions that may arise when using the
   utilities. The utilities themselves are detailed in this chapter in their
   own sections and a section has been dedicated to the File Handler
   utilities demonstration programs supplied with this COBOL system, that
   show you how to use each utility.

   OPERATION
   =========
   To use the File Handler utilities you need to specify a number of
   parameters. You can do this in one of two ways:

    o  use a text editor to produce a line sequential file

    o  enter the required parameters on standard input (stdin) during
       utility execution

   Each utility has a unique parameter file format described in that
   utility's section later in this chapter.

   The line sequential parameter file holds records, each consisting of a
   parameter type and an optional parameter value. The parameter type is
   always the first two characters of the record. The remainder of the
   record is the parameter value.

   You can insert comments and comment lines in a parameter file. A comment
   is recognized by the first character being a hash character ( # ). These
   characters and lines are ignored by the utilities. There is no
   restriction on their content except that the characters should be
   printable. You also can insert blank lines to make the file more
   readable.

   All utility output is to standard output (stdout), except errors. Errors
   are output to standard error (stderr).

   When you have created the parameter files, you then invoke the utilities.

   Invoking the File Handler Utilities
   ===================================
   You can invoke the File Handler utilities either from the command line or
   by calling them from a COBOL program. The following sections describe
   these methods.

   Command Line
   ------------
   The command line you use to invoke the File Handler utilities consists of
   the utility name, any flags you want to include, plus the name of the
   parameter file you want to use:

       utility-name [-e] [-p filename] [flags]
                                   parameter-filename
   where:

   utility-name          is the name of the utility you want to run. This
                         can be any one of:

                           fhconvert
                           fhcreate
                           fhedit
                           fhinfo
                           fhrebuild
                           fhreorg
                           fhvalidate

   -e                    is optional and suppresses all screen output (for
                         example, error messages)

   -p                    is optional and causes the IN or ON filename to be
                         overwritten by the filename specified after this
                         flag

   filename             is the name of the file on which you want to run
                         the utility

   flags                 are optional and can be:

                         -c    for use with fhconvert and fhcreate only
                           and deletes any existing file with the same
                           filename and also invokes the -r flag

                         -f    for use with fhinfo and fhvalidate only
                           and specifies that you want the file
                           information to go to a file. If you do not
                           specify -f, the output goes to standard
                           output (stdout). Any file created using
                           the -f flag can be submitted to other
                           utilities; for example, the fhrebuild utility

                         -o    for use with fhinfo and produces output
                              parameters, as opposed to input
                           parameters, to allow the output parameter
                           file to be used as input to fhrebuild

                         -r    for use with any utility and overwrites
                           any existing temporary work file
                           (filename.con)

                         -v    for use with any utility and displays the
                            banner giving a version number and
                           copyright

   parameter-filename

                         is either the name of your parameter file, or a
                         minus sign ( - ) to use parameters from standard
                         input (stdin). See the section Using Standard Input
                         with the Utilities for further information on
                         specifying the minus sign in place of a parameter
                         filename.


   Using Standard Input with the Utilities
   ---------------------------------------
   When you specify the minus sign ( - ) in place of the parameter
   filename, it enables you to enter parameters interactively. To do this,
   you type parameters as you would in a parameter file, pressing Enter
   after each parameter, including the last entry. When you have typed all
   the parameters you require, enter Ctrl+D to conclude parameter entry.

   Calling the File Handler Utilities from COBOL
   ---------------------------------------------
   You also can invoke any of the available utilities directly from your
   COBOL application by incorporating a call to the cobcallfhutil routine.
   The call has the following format:

       call "cobcallfhutil" using by value noargs,
                                  by reference arg1,
                                               arg2,
                                               arg3,
                                               arg4,
                                               arg5,
                                               arg6,
                                               arg7,
                                               arg8,
                                               arg9,
                                               arg10
       end-call

       where all arguments are for input, and:

   noargs                is a mandatory PIC 9(2) COMP-5 field that contains
                         the number of arguments you supply

   arg1                  is a mandatory PIC X(n) field that contains the
                         name of the utility you want to call

   arg2                  is a mandatory PIC X(n) field that contains the
                         first utility argument.

                         A utility argument can be -e, -p, the name of the
                         file on which you want to run the utility, any of
                         the flags -c, -f, -o, -r or -v, or the name of your
                         parameter file or a minus sign ( - ) to use the
                         parameters from standard input (stdin). See the
                         section Command Line above for descriptions of
                         these parameters.

   arg3                  is an optional PIC X(n) field that contains the
                         second utility argument

   arg4                  is an optional PIC X(n) field that contains the
                         third utility argument

   arg5                  is an optional PIC X(n) field that contains the
                         fourth utility argument

   arg6                  is an optional PIC X(n) field that contains the
                         fifth utility argument

   arg7                  is an optional PIC X(n) field that contains the
                         sixth utility argument

   arg8                  is an optional PIC X(n) field that contains the
                         seventh utility argument

   arg9                  is an optional PIC X(n) field that contains the
                         eighth utility argument

   arg10                 is an optional PIC X(n) field that contains the
                         ninth utility argument

   The COBOL RETURN-CODE special register contains either zero for a
   successful utility execution, or non-zero if the utility execution fails.

   File Types Supported by the File Handler Utilities
   ==================================================
   The File Handler utilities support all file formats created by LEVEL II
   or later versions of this COBOL system. The File Handler utilities
   support five types of indexed files:

    o  C-ISAM format

    o  X/Open format

    o  LEVEL II format (created by LEVEL II or later versions of COBOL)

    o  Indexed file format used by this COBOL system

    o  IDXFORMAT"4"

   Printer formatted line advancing files, not normally intended for access,
   are not supported. Full details of these file formats can be found in the
   appendix File Formats later in this manual.

   The utilities are mainly for use with indexed files although some
   utilities also support relative, sequential and line sequential files.
   Fixed record length and variable record length files are supported for
   all file types except fixed, line sequential.

   The different characteristics of the various file types are important
   when using these utilities. These are described in the following
   sections.

   Line Sequential Files
   ---------------------
   Line sequential files are a special type of file consisting of a series
   of variable length records. They correspond directly to text files
   produced by standard editors.

   Sequential Files
   ----------------
   Sequential files have their records stored in the order in which they are
   written. This order is fixed. These can contain fixed or variable length
   records.

   Relative Files
   --------------
   Relative files are organized by records being stored in a specific
   position in relation to the beginning of the file. These can contain
   fixed or variable length records.

   Indexed Files
   -------------
   Indexed sequential files consist of a series of fixed or variable length
   records. An indexed sequential file is implemented as two separate files:
   the data file and the key or index file.

   Record Delimiters
   -----------------
   Fixed record length indexed, relative and line sequential records use one
   of two record delimiters. These are:

    o  line feed (LF)

    o  carriage return and line feed (CR & LF)

   For fixed record length indexed files you specify the delimiter in the
   data file, not the index file.
   If the delimiter needs to be specified for a utility, you set this in the
   parameter file used by the utility.

   You should not specify a record delimiter for sequential files or
   variable record length indexed files.

   Default File Type Parameters
   ============================
   The following two tables list default file type parameters, where the
   first character is a letter and the second character is a digit. Table 1
   shows the file type parameters for the UNIX operating system running this
   COBOL system. Table 2 shows the file type parameters for the DOS or OS/2
   operating systems running this COBOL system.

   Table 2 is included so you are aware of the differences of the file type
   parameters output should you want to convert files produced under DOS or
   OS/2 to UNIX.


    Table 1 : Default UNIX File Type Parameters

                               File Type   Delimiter   Block Size
    -----------------------------------------------------------------------
    Indexed Fixed              I0          N/A         1023
    Indexed Variable           I3          N/A         1023
    Relative Fixed             R0          0           N/A
    Relative Variable          R0          1           N/A
    Sequential Fixed           S0          N/A         N/A
    Sequential Variable        S0          N/A         N/A
    Line Sequential            L0          1           N/A
    IDXFORMAT"4" indexed       I4          N/A         1023


   Table 2 : Default DOS and OS/2 File Type Parameters

                               File Type   Delimiter   Block Size
    -----------------------------------------------------------------------
    Indexed Fixed              I3          N/A         1023
    Indexed Variable           I3          N/A         1023
    Relative Fixed             R0          1           N/A
    Relative Variable          R0          1           N/A
    Sequential Fixed           S0          N/A         N/A
    Sequential Variable        S0          N/A         N/A
    Line Sequential            L0          0           N/A
    IDXFORMAT"4" indexed       I4          N/A         1023


   Default Index Block Size
   ========================
   The File Handler utilities have a default block size of 1 kilobyte (1K),
   identical to the run-time system indexed file block size.

   If you want to alter the default setting, you must use the cobconfig
   variable isam_block_size. See the chapter Run-time Configuration later in
   this manual for details.

   Use of Keys in Indexed Files
   ============================
   When you create an indexed file, a primary index is created that can
   never be deleted.

   When you set up a key, each key can be multi-part and each part can be in
   a different area of the record; these do not have to be contiguous and do
   not have to exist in any particular order. All keys, other than the prime
   key, can hold duplicates.
   Keys are specified by a key description.

   This description takes the following format:

       [compression-type] (m:n:xxx/m:n:xxx/....)

   where:

   compression-type      is optional and can consist of:

                         C  -  all compression

                         or any combination of:

                         D  -  duplicates allowed
                         S  -  same key (duplicate) compression
                         L  -  leading compression
                         T  -  trailing compression

   m                     is the start offset of the key in a record

   n                     is the key length

   xxx                   is the key type, that must currently be CHAR or
                         CHARTYPE

   For example, to specify a prime key of length four bytes starting at
   record offset zero, the entry would be:

   PK (0:4:CHAR)

   and to specify a multi-part alternate key for which duplicates are
   permitted with key compression, the first part starting at record offset
   four having length two bytes and the second part starting at record
   offset twelve having length six bytes would be:

   AK DS (4:2:CHAR/12:6:CHAR)

   To specify the key offset and key length, you can use any combination of
   size mnemonics, digits and arithmetic calculations (addition,
   subtraction, multiplication and division) including parentheses. The
   precedence for arithmetic calculations is as follows:

       (  )    parentheses
       *  /    multiplication and division
       +  -    addition and subtraction

   Calculations are performed from left to right; integer values only are
   accepted (no decimal values are accepted). You cannot use negative
   numbers.

   Consider the following examples:

   10 + 6  / 2 = 10 + 3 = 13
   (10 + 6) / 2 = 16 / 2 = 8

   The appendix Example fhconvert Parameter File, that gives an example of a
   parameter file, illustrates the ways you can give key descriptions.

   Indexed files can hold a number of indices. Further indices can be added
   to files, by using the utility fhedit.

   These utilities also support compressed indexed files of the type used by
   this COBOL system.

   Error Handling
   ==============
   If you specify the -e option with your File Handler utilities, any error
   messages output are suppressed. We recommend that you specify the -e
   option as the first flag to suppress command line parsing errors.

   When calling the utilities from COBOL, a COBOL file status type error and
   the RETURN-CODE are available to the calling program. The file status
   item is returned in the two-byte external data item cob_util_last_error.
   This item is decoded the same as any COBOL file status item.

   The first byte of the status is called status key 1. This reports on the
   general success or failure of an input-output operation on a file. The
   second byte is called status key 2, that contains any further information
   available.

   If you want to display this item with its correct decimal value, you must
   use careful redefinition to avoid truncation of the value. This is
   because the facility enables the storage of values greater than decimal
   99, as a binary value.

   The example below shows you how to define and access the external data
   item cob_util_last_error, and demonstrates one method of retrieving
   status key 2 for display purposes. Truncation has been avoided by
   redefining the two status bytes as one numeric data item (with a length
   of two bytes) capable of storing up to four decimal digits. The
   demonstration program, validate2, supplied with the file handler
   utilities, makes use of the data item cob_util_last_error.


   working-storage section.

   * Utility arguments

   * external status and decoding variables

    01 cob_util_last_error external.
        03 status-1  PIC X.
        03 status-2  PIC X.
        03 status-2-9 redefines status-2  PIC 9.
    01 reply-bin redefines cob_util_last_error  PIC 9(4) comp.

    01 reply-decode.
        03 reply-1   PIC X.
        03 reply-2   PIC 999.

    procedure division.

   * Code to call the utilities

        perform get-file-status

   * Status handling code

        stop run.

   * Decode the returned 2 byte status

    get-file-status.
        move status-1 to reply-1
        if reply-1 not=9
            move status-2-9 to reply-2
        else
            move low-values to status-1
            move reply-bin to reply-2
        end-if

   This file status data item is also available when calling the utilities
   from any language. In non-COBOL calling programs, the external variable
   should be referenced as cob_util_last_error. For COBOL, the underscores
   are mapped to hyphens.

   Error Conditions
   ================
   There are two possible types of error condition:

    o  Utility errors

    o  File specific errors

   Details of utility errors can be found in the appendix File Handler
   Utility Error Messages.

   If the error indicates you have given invalid or duplicate parameters,
   the error message always displays the parameter file entry that is at
   fault.

   For each file type there are two error variables used to define the
   problem encountered: the error number and the error status. The error
   number gives a global definition of the error encountered with the error
   status providing any additional information.

   The names of the error number and status variables differ according to
   the file type. They are:

   -------------------------------------------------------------------------
   File Type             Error Number                Status Variables
                                                     Status 1 Status 2
   -------------------------------------------------------------------------
   indexed                     iserrno               isstat1  isstat2

   relative                    rlerrno               rlstat1  rlstat2

   sequential                  sqerrno               sqstat1  sqstat2

   line sequential             lserrno               lsstat1  lsstat2

   You can find full details of the meaning of the error numbers and status
   variables in the appendix "File Handler Utility Error Messages".

   If the error is concerned with the operating system, the value of errno,
   the operating system error variable, is displayed in the error message.
   For more information consult your operating system documentation.

   Creating Statically Linked Executable Files
   ===========================================
   By default, any statically linked executable files created by your COBOL
   system excludes these utilities.

   The utilities are, however, included if your COBOL program contains a
   reference to the utility entry point cobcallfhutil. Alternatively, you
   can ensure that the utilities are included by using the -I fhutil option
   on your cob command line. For example:

   cob -xvo newrts32 prog1.o prog2.o -I fhutil

   See the chapter COBOL System Interface (cob) earlier in this manual for
   details of the cob command.

   fhconvert Utility
   =================
   The fhconvert utility enables you to convert an existing file to a
   different file format. You can change:

    o  File organizations to relative, sequential, line sequential or
       indexed

    o  Record types to fixed length or variable length

    o  File indices, that can be added or deleted

    o  The NLS language of the file for systems that support NLS (for
       indexed files only)

    o  Record delimiters

    o  File formats, for example C-ISAM to LEVEL II

    o  Index block sizes (for indexed files only)

    o  Data compression type (for indexed files only)

   This utility always produces a new file from the existing file unless an
   error condition occurs. To use this utility you must first construct a
   parameter file that holds details of the existing file as well as the
   details of the file conversion. You then invoke the utility. The
   parameter file holding details of the existing file can be created using
   the utility fhinfo (see the section fhinfo Utility for further details of
   how to do this).

   fhconvert Parameter File Format
   -------------------------------
   The parameter file records are:


   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   IN                      xxxxxxxxxx            Input filename (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
                                                 R0  Relative
                                                 S0  Sequential
                                                 L0  Line sequential

   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 (omit for indexed
                                                 files)

   IV                      mmmm/nnnn             Variable record length
                                                 minimum (m), maximum (n)
                                                 (omit for indexed files)

   ON                      xxxxxxxxxx            Output filename

   OT                      xx                    Output file types. As input
                                                 file types above.

   -------------------------------------------------------------------------
   Parameter   Parameter
   Type        Value               Description
   -------------------------------------------------------------------------
   OD                      n                     Optional - record delimiter
                                                 (omit for indexed and
                                                 sequential files):

                                                 0 = LF (default)
                                                 1 = CR and LF

   OF                      nnnn                  Fixed record length in
                                                 bytes

   OV                      mmmm/nnnn             Variable record length,
                                                 minimum (m), maximum (n)


   In addition, the following information refers to indexed files only:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   OB                      nnnn                  Index block size 511, 1023
                                                 or 4095

   OE                                            Optional - when specified,
                                                 .dat extension for output
                                                 file not required

   NL                      xxxxx....             Optional - NLS language
                                                 name

   PK                      DSLTC
                           (m:n:xxx:m:n:xxx/...) Primary key description

   AK                      DSLTC
                           (m:n:xxx:m:n:xxx/...) Optional - alternate key
                                                 description, one for each
                                                 alternate key used in file

   DC                      nnn                   Optional - data compression
                                                 type (0 - 255, indexed and
                                                 sequential files only)


   For more information on keys, see the section Use of Keys in Indexed
   Files earlier in this chapter.

   fhconvert Error Messages
   ------------------------
   fhconvert gives the following warning message if you include the input
   record size for an indexed file:

   (IF/IV) Record length is ignored for input ISAM file

   You do not need to give this information, because fhconvert takes these
   details from the file (you must include this information for other file
   types). This is only a warning message; the utility should run normally
   unless an error situation is detected.

   If you include a record delimiter in the parameter file for a sequential
   file you see the following warning message:

   Record delimiter has been specified for sequential file

   The utility ignores the record delimiter, as it is not applicable to
   sequential files, and continues as normal.

   If you specify data compression type for an indexed output file type
   other than I3, I4 or S0,  you receive the following warning message:

       Data compression only valid for file types I3, I4 and S0, file type
       updated

   fhconvert automatically selects the I3 file type to enable data
   compression to be used. If you specify a data compression type for a
   non-indexed output file type you receive the following warning message:

       Data compression only valid for ISAM files - ignored

   fhconvert automatically disregards the data compression type specified.
   If an error is detected, the utility 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,
   with other relevant information.

   fhcreate Utility
   ================
   The fhcreate utility enables you to create an empty indexed file.

   You may find this utility useful if an application needs a file to exist,
   but allows it to be empty.

   To use this utility you need to create a parameter file holding
   information on the type of indexed file you want to create including
   information about keys in the file. You then invoke the utility.


   fhcreate Parameter File Format
   ------------------------------
   The parameter file records are:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   ON                      xxxxxxxxxx            Output filename (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                                            Optional - NLS language
                                                 name

   PK                      DSLTC
                           (m:n:xxx/m:n:xxx/...) Primary key description

   AK                      DSLTC
                           (m:n:xxx/m:n:xxx/...) Optional - alternate key
                                                 description, one for each
                                                 alternate key used in file

   DC                      nnn                   Optional - data compression
                                                 type (0 - 255, indexed
                                                 files only)

   For more information on keys, see the section Use of Keys in Indexed
   Files earlier in this chapter.

   fhcreate Error Handling
   -----------------------
   If an error is detected, fhcreate closes all files, then terminates,
   displaying a message on the screen indicating the type of error detected.

   If you specify a data compression type (other than 0) for a non-indexed
   file you receive the following warning message:

   Data compression only valid for ISAM files - ignored

   fhcreate automatically disregards the data compression type specified.

   If you specify a data compression type (other than 0) for an indexed file
   type other than I3 or I4, you receive the following warning message:

   Data compression only valid for files type I3, I4 or S0, file type
   updated to I3

   fhcreate automatically selects the I3 file type to enable data
   compression to be used. 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.

   fhedit Utility
   ==============
   The fhedit utility enables you to alter indices in an indexed file. There
   are two main functions:

    o  adding and deleting indices

    o  repairing a corrupt file

   You cannot delete the primary index using this utility.

   You can use fhedit with the fhvalidate utility to repair corrupt indices.
   The fhvalidate utility gives details of the corrupt indices in the file.

   To use this utility you need to create a parameter file giving details of
   the file you want to use, and details of the existing key(s) you want to
   delete and/or the new key(s) you want to add. You then invoke the
   utility.

   If you ran fhvalidate first, and the validation resulted in a file
   suitable for use with fhedit, you can use this file as the parameter
   file. In this case you do not need to create an additional parameter
   file.

   fhedit Parameter File Format
   ----------------------------
   The parameter file records are:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   IN                      xxxxxxxxxx            Input filename (length is
                                                 operating system dependent)


   IE                                            Optional - when specified,
                                                 .dat extension for input
                                                 file not required

   IT                      xx                    Optional - 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

   NL                      xxxxx                 Optional - NLS language
                                                 name

   AK                      DSCTL
                           (m:n:xxx/m:n:xxx/...) Alternate key description
                                                 to be added

   DK                      DSCTL
                           (m:n:xxx/m:n:xxx/...) Alternate key description
                                                 of the key to be deleted


   Note: You cannot use fhedit in with IDXFORMAT"4" indexed files.

   For more information on keys, see the section Use of Keys in Indexed
   Files earlier in this chapter.

   fhedit Error Handling
   ---------------------
   If an error is detected, fhedit 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. If your file uses data
   compression you MUST specify a file type of I3. This is the file type
   returned by fhinfo for files using data compression. You do not need to
   specify the data compression type being used, as fhedit uses the type
   already specified in the file.

   fhinfo Utility
   ==============
   The fhinfo utility enables you to obtain information about an existing
   indexed file. This information consists of file and index information.

   To use fhinfo you need to construct a parameter file containing the name
   and type of file you want to use. You then invoke the utility. The
   information output by fhinfo is in the format of the input parameters to
   fhvalidate.

   Note: The number of records in a variable format file cannot be
         determined and is given as -1.

   fhinfo Parameter File Format
   ----------------------------
   The parameter records are:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   IN                      xxxxxxxxxx            Input filename (length is
                                                 operating system dependent)

   IT                      xx                    Optional - 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

   IE                                            Optional - when specified,
                                                 .dat extension for input
                                                 file not required


   Example
   -------
   On a C-ISAM file called test, where the physical files created are test
   and test.idx, the fhinfo parameter file is:

       IN test     # Input filename
       IT I0       # C-ISAM file
       IE          # Required when the data part is created as test rather
                     than test.dat.


   fhinfo Error Handling
   ---------------------
   If an error is detected, fhinfo 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.
   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 has
   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:

    o  Fixed or variable length file

    o  Record length

    o  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 you do not need to create an additional
   parameter file.

   fhrebuild, if successful, replaces the existing file with the newly
   indexed file. However, this may not always be possible as inconsistencies
   in the data file can render an indexed file incapable of being rebuilt.
   If fhrebuild fails, the file is left in the same form as before using the
   utility and an appropriate error message is given.

   fhrebuild Parameter File Format
   -------------------------------
   The parameter file records are:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   ON                      xxxxxxxxxx            Output filename (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
                           (m:n:xxx/m:n:xxx/...) Primary key description

   AK                      DSLTC
                           (m:n:xxx/m:n:xxx/...) Optional - alternate key
                                                 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 to reorganize 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
   Type       Value                  Description
   -------------------------------------------------------------------------
   IN                      xxxxxxxxxx            Input filename (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

   -------------------------------------------------------------------------
   Parameter   Parameter
   Type        Value               Description
   -------------------------------------------------------------------------
   KN                      xxx                   Key number of access key
                                                 (1 = prime)

   ON                      xxxxxxxxxx            Output filename (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 IT
                                                 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 closes 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 consistency. It
   gives you 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 can see various messages during and after
   the validation, detailed in the section Validation Information Messages.

   When used with an indexed file, if the file is 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 in 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 or
   I4.

   The parameter file records are:

   -------------------------------------------------------------------------
   Parameter  Parameter
   Type       Value                  Description
   -------------------------------------------------------------------------
   IN                      xxxxxxxxxx            Input filename (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:
   # Cannot recover from previous error, quitting file validation

    o  The preceding reported error has resulted in an unsuccessful
       completion of the validation.

   # Error - Index entries inconsistent with records on data file

    o  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 = )

    o  The specified record in an indexed file is inconsistent.

   # Error detected on index nn. (iserrno = )

    o  The specified index is inconsistent.

   # Error - Index record size incorrect

    o  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)

    o  The specified record in the named file is inconsistent.

   # File needs to be edited. Creating parameter file for fhedit

    o  The utility has diagnosed that 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

    o  The utility has diagnosed that 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

    o  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 filename

    o  This indicates that the named file inspected by the fhvalidate
       utility has been found to be consistent.

   Validation of file was unsuccessful filename

    o  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 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 section "File Handler Utility Error Messages",
   along with any other relevant information.


   Demonstrating the File Handler Utilities
   ========================================
   The File Handler utilities are supplied with a suite of demonstration
   programs. The aim of the demonstration programs is to give you an insight
   into the usage and the versatility of the File Handler utilities, and to
   allow you to see the correlation between COBOL file handling syntax and
   the File Handler utilities.

   We recommend that you view on the screen the contents of all files in
   each of the demonstration programs. You may want to adopt their layout
   and construction when creating files of your own. A knowledge of COBOL
   and file structures would be useful but not essential for understanding
   these demonstrations.

   You can find descriptions of all files in the demonstration programs. In
   addition, all COBOL sources that read, write or create files have their
   records and files described using the File Handler utilities parameter
   file entries. The following sections guide you step by step through each
   of the demonstration programs.

   File Handler Utilities Demonstration Programs
   ---------------------------------------------
   The demonstration programs use the seven File Handler utilities that, for
   demonstration purposes, are grouped into five logical areas:

    o  fhinfo

    o  fhcreate and fhedit

    o  fhvalidate and fhrebuild

    o  fhconvert

    o  fhreorg

   You invoke the utilities as shown in the section Invoking the File
   Handler Utilities earlier in this chapter. An example command line is:

   fhinfo -rv info.inf

   where:

   fhinfo                is the utility

   -rv                   tells the utility to overwrite any work files that
                         exist (r) and to display the copyright banner (v)
   info.inf              contains the parameters required by the utility

   As mentioned earlier, input to all the utilities is via parameter files.
   This input can be from a physical file or typed directly using the
   utilities' additional capability of reading input from standard input
   (stdin). To pass input from standard input, you should use a minus sign
   (-) instead of a parameter filename on the command line. See below for
   details of this feature.

   The demonstration program files are contained in \$COBDIR/demo/fhutils.
   Before using the demonstrations, you need to change to the
   \$COBDIR/demo/fhutils and set up the files. To change to the relevant
   directory, type:

       cd \$COBDIR/demo/fhutils

   You then type:

       setup

   to set up the files.

   Running the setup program removes any files that were created by
   previously running these demonstration programs, and reinstates the
   supplied corrupt file, badfile, used in the demonstrations later in this
   chapter. It also ensures that all the necessary files for this
   demonstration are in \$COBDIR/demo/fhutils.

   All programs have been compiled for animation, since animating them
   allows you greater visibility of the demonstration programs. Once you
   have run the setup program, you are ready to run the demonstration
   programs.

   demo1 Demonstration Program
   ---------------------------
   The demo1 demonstration program uses the File Handler utility fhinfo.
   fhinfo enables you to obtain information about a file and its index. Use
   of fhinfo is restricted to indexed files.

   demo1 uses the following six files:

       info1.int (info1.cbl, info1.idy)
       info1a.int (info1a.cbl, info1a.idy)
       info1.inf
       info2.int (info2.cbl, info2.idy)
       info2a.int (info2a.cbl, info2a.idy)
       info2.inf

   The files are described in the following sections in the order in which
   they are to be used.


   info1 Demonstration Program:

   Run the info1 demonstration program by typing:

   cobrun info1.int

   Running the info1 demonstration program creates an indexed file called
   demofile with fixed length records, and writes one record to the file.

   If you view the file info1.cbl you can see comments showing how the COBOL
   syntax equates to fhinfo's output.


   info1.inf Parameter File:

   The info1.inf parameter file is used by fhinfo to obtain information
   about demofile that you created by running the info1 demonstration
   program. The info1.inf parameter file contains the following lines:

   IN demofile
   IE

   IN specifies that the filename from which you want to obtain information
   is called demofile, and IE specifies that the data file has no .dat
   extension, the default for all files created using your COBOL system.

   Run the fhinfo utility by typing:

   fhinfo -rv info1.inf

   You can see file information for demofile displayed on the screen after
   the copyright banner as follows:

   IN demofile
   IE
   IT I0
   IF 20
   # Number of records - 1
   # Block size - 1023
   NL n-computer
   PK (0:8:CHARTYPE)
   AK D(8:4:CHARTYPE)
   AK (12:4:CHARTYPE)
   AK (16:4:CHARTYPE)

   By looking at the code that created this file (info1.cbl), you can see
   how this relates to the key and record descriptions for the file.

   Rerun the fhinfo utility by typing:

   fhinfo -f output -rv info1.inf

   The file information of the file demofile displayed the first time you
   ran fhinfo is sent to an output file called output. This allows you to
   use the file output as a parameter file for other utilities. This is
   described in the section Rebuilding a File using the -o Option later in
   this chapter.


   info1a Demonstration Program:

   The info1a demonstration program contains code for the first call you
   made to fhinfo in a COBOL program.

   Run the info1a demonstration program by typing:

   cobrun info1a.int

   When you run this program, the same information as when you ran fhinfo
   -rv info1 is displayed on the screen. For an explanation of the code see
   the section Calling the File Handler Utilities from COBOL earlier in this
   chapter.


   info2 Demonstration Program:

   The info2 demonstration program creates a file called demofile2 similar
   to that created by running info1, except this time the file contains
   variable length records.
   Run the info2 program by typing:

   cobrun info2.int


   info2.inf Parameter File:

   The info2.inf parameter file contains parameters similar to those
   contained in the parameter file info1.inf, the only change is the
   filename:

   IN demofile2
   IE

   IN specifies that the filename from which you want to obtain information
   is demofile2, and IE specifies that the data file has no .dat extension,
   the default for all files created using your COBOL system.

   Run the fhinfo utility by typing:

   fhinfo -rv info2.inf

   You can see the file information for demofile2 displayed on the screen
   after the copyright banner as follows:

   IN demofile2
   IE
   IT I3
   IV 20/30
   # Number of records -  -1
   # Block size - 1023
   NL n-computer
   PK (0:8:CHARTYPE)
   AK D(8:4:CHARTYPE)
   AK (12:4:CHARTYPE)
   AK (16:4:CHARTYPE)

   Although you have been supplied with the parameter file info2.inf, you
   can reuse the parameter file info1.inf, that contains the following
   parameters:

   IN demofile
   IE

   To reuse this file to obtain information about demofile2, run the fhinfo
   utility by typing:

   fhinfo -p demofile2 -rv info1.inf

   This causes the demofile referenced in the parameter file to be
   overwritten with the filename demofile2 at execution time.

   info2a Demonstration Program:

   As with info1a, this program contains the code for the call to fhinfo
   from COBOL to perform the first of the two example calls above.

   Run the info2a demonstration program by typing:

   cobrun info2a.int

   When you run this program, the same information as when you ran fhinfo
   -rv info2 is displayed on your screen.

   demo2 Demonstration Program
   ---------------------------
   The demo2 demonstration program uses the File Handler utilities fhcreate
   and fhedit. fhcreate enables you to create an empty indexed file, and
   fhedit allows you to add and delete alternate keys.

   demo2 uses the following six files:

       create.cre
       create.int (create.cbl, create.idy)
       create.inf
       edit.edi
       edit.int (edit.cbl, edit.idy)
       edit2.int (edit2.cbl, edit2.idy)

   The files are described in the following sections in the order in which
   they are to be used.

   create.cre Parameter File:

   The create.cre parameter file contains parameters that enable fhcreate to
   create an indexed file identical to the file you created by running info1
   using demo1, as follows:

   ON demofile3        # filename of file to be created
   OE                  # no .dat extension
   OT I0               # indexed fixed
   OF 20               # fixed record length of 20 bytes
   PK (0:8:CHARTYPE)   # Prime key
   AK D(8:4:CHARTYPE)  # An alternate key with duplicates allowed
   AK (12:4:CHARTYPE)  # Another alternate key
   AK (16:4:CHARTYPE)  # And yet another

   Create an empty indexed file by typing:

   fhcreate -cv create.cre

   where:

   -c                    tells fhcreate to remove any work files and the
                         indexed file demofile3 if it exists.


   create.inf Parameter File:

   The create.inf parameter file contains parameters that enable the fhinfo
   utility to obtain information about the empty indexed file you created in
   the section create.cre Parameter File above.

   To obtain information on the empty indexed file, type:

   fhinfo -rv create.inf

   You also can use fhinfo with fhcreate to allow you to produce a file
   similar to demofile. To do this, you use fhinfo to obtain information on
   the file demofile. However, although the information produced is all you
   need to know to create a similar file, the parameter types are incorrect;
   that is, fhinfo creates IN, IT, and so on, whereas fhcreate requires ON,
   OT, and so on.

   To change the parameter types to those that fhcreate require, rerun
   fhinfo with the -o option by typing:

   fhinfo -orv create.inf

   Therefore, to create a copy of the file you created by running info1,
   type:
   fhinfo -orv info1.inf | fhcreate -p demofile3 -cv -

   When you do this, fhinfo displays the file information on your screen
   standard output (stdout). The fhcreate command takes its input from
   standard input (stdin) signified by a minus sign ( - ) at the end of the
   command line. By using the UNIX pipe ( | ) the output from fhinfo is
   redirected to fhcreate. The -p option is specified to allow the filename
   read by fhcreate to be replaced by the filename of this new identical
   file demofile3.


   create Demonstration Program:

   The create demonstration program contains code that calls fhcreate from
   COBOL. To run the create program, type:

   cobrun create.int


   edit.edi Parameter File:

   The edit.edi parameter file contains parameters that allow fhedit to add
   and remove alternate keys from the file you have just created (in this
   case demofile3). Before running fhedit, you must run fhcreate, otherwise
   you get an error as fhedit tries to add a key that exists.

   The edit.edi parameter file contains the following parameters:

   IN demofile3            # The filename
   IT I0               # indexed fixed
   IE                      # no .dat extension
   AK DC(7:1:CHARTYPE) # Add a key with duplicates allowed and
                            compression
   DK (12:4:CHARTYPE)      # Delete a key
   AK (12:2:INTTYPE)       # And add another

   To add these keys to your newly created file (demofile3), type:

   fhedit -rv edit.edi

   You can now rerun fhinfo as follows to view the new parameters of this
   file:

   fhinfo -rv create.inf


   edit Demonstration Program:

   The edit demonstration program contains code that performs a read and
   write to an edited file. To see how this new structure relates to COBOL
   syntax, view the edit.cbl source file. To perform the read and write to a
   file, run this program (remembering to run fhcreate first) by typing:

   cobrun edit.int


   edit2 Demonstration Program:

   The edit demonstration program contains code for the fhedit call used in
   the section edit.edi Parameter File, above, but this time via a COBOL
   program. If you have already run fhedit, you must rerun fhcreate before
   continuing. To run this demonstration program, type:

   cobrun edit2.int

   demo3 Demonstration Program
   ---------------------------
   The demo3 demonstration program uses the File Handler utilities
   fhvalidate and fhrebuild. fhvalidate enables you to validate whether a
   file is corrupt, how it is corrupt and produces output parameters so you
   can use fhrebuild to rebuild the file.

   To demonstrate the use of these two utilities, there is a supplied
   corrupt file, badfile, and its index file, badfile.idx. When you run
   setup, these files are copied to the indexed files corrupt and
   corrupt.idx, the files that you actually use. If you want to reinstate
   the corrupt file, you can copy these files yourself.

   demo3 uses the following six files:

       validate.val
       validate2.int (validate2.cbl, validate2.idy)
       info.inf
       rebuild.int (rebuild.cbl, rebuild.idy)
       validate.int (validate.cbl, validate.idy)
       validate.inf

   The files are described in the following sections in the order in which
   they are to be used.


   validate Demonstration Program:

   The validate demonstration program contains code to read and write to the
   indexed file corrupt. Run this program as follows:

   cobrun validate.int

   You can see that an error occurs indicating that the file is corrupt. You
   can now validate the file and rebuild it so next time you run validate,
   the error does not occur and the reads and writes to this file are
   successful.


   validate.val Parameter File:

   The validate.val parameter file is used by fhvalidate to enable it to
   validate the corrupt indexed file corrupt.

   This parameter file contains the same parameters as the parameter file
   for fhinfo, except this parameter file includes the file type parameter
   IT. This means that you can create one parameter file for use by both
   utilities by including this parameter in the fhinfo parameter file,
   although this is optional. Thus the parameter file contains:

   IN corrupt  # the corrupt files name
   IT I0       # indexed fixed
   IE              # no .dat extension

   To validate corrupt, type:

   fhvalidate -rv validate.val

   fhvalidate first validates the file by reading the file sequentially via
   all the keys. It then validates the file by random reads on each of the
   keys. fhvalidate detects an error on record 8/7 and produces a parameter
   file for use with fhrebuild to rebuild corrupt. As you can see, the
   output is displayed on the screen; you need to place the output in a file
   so you can use the parameter file to rebuild corrupt. Using this method
   to rebuild a file, you use the parameter file rebuild.reb as a stepping
   stone between fhvalidate and fhrebuild. To do this, rerun the fhvalidate
   utility by typing:

   fhvalidate -f rebuild.reb -rv validate.val

   This places the output in a file that, in this demonstration, is called
   rebuild.reb. You can now use rebuild.reb to rebuild the corrupt file:

   fhrebuild -rv rebuild.reb

   If you now rerun the validate demonstration program by typing:

   cobrun validate.int

   You can see that the reads and writes are successful. If you want to
   verify that the file has been successfully rebuilt, rerun fhvalidate as
   follows:

   fhvalidate -rv validate.val

   This is one of many ways to rebuild a file. Several other ways to rebuild
   a file are described below.


   Rebuilding a File without using a Parameter file:

   The command you use to rebuild a file without using a parameter file is
   almost the same as you use with fhcreate when duplicating a file. Type:

   fhvalidate -rv validate.val | fhrebuild -rv -


   Rebuilding a File using the -o Option:

   You may recall that in the fhcreate demonstration programs earlier, you
   used the -o option with fhinfo to produce 'ON, OT' type parameters. You
   can use this functionality again to rebuild a file. Type:

   fhinfo -orv validate.val | fhrebuild -rv -

   This method shares the parameter files between fhinfo and fhvalidate, as
   mentioned earlier in this chapter.


   Combining fhinfo and fhrebuild to Rebuild a File:

   To rebuild a file using fhinfo and fhvalidate, type:

   fhinfo -f rebuild.reb -orv validate.val

   fhrebuild -rv rebuild.reb


   validate2 Demonstration Program:

   The validate2 demonstration program performs the validation of the file
   corrupt via a COBOL call. To run this program, type:

   cobrun validate2.int

   When you run validate2 a file status returned by fhvalidate is displayed.
   The file status is accessed via the external variable
   cob_util_last_error. For further details of the usage of this file
   status, and how to decode this external variable, see the section Calling
   the File Handler Utilities from COBOL earlier in this chapter.

   rebuild Demonstration Program:

   The rebuild demonstration program contains code that performs a call to
   fhrebuild to rebuild the corrupt file. Before running this utility, the
   file rebuild.reb must exist. To run this demonstration program, type:

   cobrun rebuild.int


   validate.inf Parameter File:

   The validate.inf parameter file provides parameters that enable fhinfo to
   obtain file information on the file corrupt. To run this utility, type:

   fhinfo -rv validate.inf


   demo4 Demonstration Program
   ---------------------------
   The demo4 demonstration program uses the File Handler utility fhconvert.
   fhconvert allows you to convert one file type to another; for example,
   indexed to relative, relative to sequential, line sequential to indexed,
   and so on. This demonstration far from exhausts the uses of fhconvert, it
   simply serves to explain what fhconvert can do.

   demo4 uses the following six files:

       convert.int (convert.cbl, convert.idy)
       convert.ind
       convert.inf
       convert.seq
       convert.lsq
       convert.rel

   These files are described in the following sections. You can use them in
   any order, as long as you run the convert demonstration program first.


   convert Demonstration Program:

   The convert demonstration program contains code for creating and writing
   records to an indexed file containing fixed length records. This file has
   both data compression and key compression active. To create the file
   demofile4, type:

   cobrun convert.int


   convert.inf Parameter File:

   The convert.int parameter file enables fhinfo to obtain information about
   the data and index of the demofile4 file you created in the section
   convert Demonstration Program, above. Run the parameter file as follows:

   fhinfo -rv convert.inf


   convert.rel Parameter File:

   The convert.rel parameter file contains parameters that enable fhconvert
   to convert the indexed file demofile4 to a relative file, demofile8. The
   contents of this file are:

   IN demofile4        # Input indexed file
   IE                  # No .dat extension
   IT I3               # Input type
   ON demofile8        # Output filename
   OT R0               # File type relative
   OE                  # No .dat extension
   OF 20               # Fixed record length of 20 bytes

   To convert demofile4 to a relative file, type:

   fhconvert -rv convert.rel


   convert.seq Parameter File:

   The convert.seq parameter file provides parameters that enable fhconvert
   to convert the indexed file demofile4 to the sequential file demofile6.
   The parameters are:

   IN demofile4        # indexed input file
   IE                  # No .dat
   IT I3               # Input type
   ON demofile6        # Output filename
   OT S0               # Sequential output type
   OE                  # No .dat extension
   OF 20               # Fixed records of 20 bytes

   To convert demofile4 to a sequential file, type:

   fhconvert -rv convert.seq


   convert.lsq Parameter File:

   The convert.lsq parameter file provides parameters that enable fhconvert
   to convert the indexed file demofile4 to the line sequential file
   demofile7. The parameters provided for this purpose are:

   IN demofile4        # Indexed input file
   IE                  # No .dat
   IT I3               # Input type
   ON demofile7        # Output filename
   OT L0               # Output type L0
   OV 20/21            # Variable length record varying 20 to 21
   OE                  # No .dat extension

   To convert demofile4 to a line sequential file, type:

   fhconvert -rv convert.lsq


   convert.ind Parameter File:

   The convert.ind index parameter file provides parameters to enable
   fhconvert to convert the compressed indexed file demofile4 to the
   uncompressed indexed file demofile5. The parameters provided for this
   purpose are:

   IN demofile4        # Indexed input file
   IE                  # No .dat
   IT I3               # Input type
   ON demofile5        # Output filename
   OT I3               # Output type
   OE                  # No .dat extension
   OF 20               # Fixed length records of 20 bytes

   To convert demofile4 to an indexed file, type:

   fhconvert -rv convert.ind


   demo5 Demonstration Program
   ---------------------------
   The demo5 demonstration program uses the File Handler utility fhreorg.
   fhreorg enables you to reorganize your indexed files on a specified key
   and in either descending or ascending order.


   demo5 uses the following four files:

   reorg1.int (reorg1.cbl, reorg1.idy)
   reorg2.int (reorg2.cbl, reorg2.idy)
   reorg3.int (reorg3.cbl, reorg.idy)
   reorg.reo

   The files are described in the following sections in the order in which
   they are to be used.


   reorg1 Demonstration Program:

   Run the reorg1.cbl demonstration program by typing:

   cobrun reorg1.int

   Running the reorg1 demonstration program creates an indexed file with
   fixed length records with one alternate key, and writes four records. The
   contents of the keys are displayed as they are written.

   This file is called demofile9.


   reorg.reo Parameter File:

   The reorg.reo parameter file is used by fhreorg to reorganize the file
   demofile9 that you create by running the reorg1 demonstration program.
   The reorg.reo parameter file contains the following lines:

   IN demofile9        # File-name of file to be reorganized
   IE                  # No .dat extension
   IT I0               # Indexed fixed
   KO 0                # Ascending
   KN 2                # Key-2 (alternate key 1)
   ON demofile10       # File-name of reorganized file
   OT I0               # Indexed fixed
   OE                  # No .dat extension

   Run the fhreorg utility by typing:

   fhreorg -crv reorg.reo

   This creates a copy of demofile9 called demofile10 with the data portion
   of the files organized on ascending alternate key 1.


   reorg2 Demonstration Program:

   The reorg2 demonstration program contains the code produced by running
   fhreorg in the above section.

   Run the reorg2 demonstration program by typing:

   cobrun reorg2.int

   When you run this program, the same output as when you specified fhreorg
   -crv reorg.reo is displayed on the screen. For an explanation of this
   code, see the section Calling the File Handler Utilities from COBOL
   earlier in this chapter.


   reorg3 Demonstration Program:

   The reorg3 demonstration program reads the data portion of the
   reorganized file demofile10 as a relative file and displays the records
   as they are read.

   Run the reorg3 demonstration program by typing:

   cobrun reorg3.int

   This displays the contents of the keys read from the file and, as you can
   see, the records are now displayed in reverse order.

   FILE HANDLER UTILITY ERROR MESSAGES
   ===================================
   This appendix lists the error messages which may be displayed by the File
   Handler utilities themselves and file specific error codes which may be
   displayed for files.

   In addition to these error messages, further information is shown
   depending on the following types of problem:

    o  errors associated with records will show the record at fault

    o  errors associated with files will give either status variables (for
       relative, sequential or line sequential files) or an error number
       (for indexed files) as well as the filename, as follows:

   -------------------------------------------------------------------------
   File Type                   Error Number          Status Variables
                                                     Status 1 Status 2
   -------------------------------------------------------------------------
   indexed                     iserrno               isstat1  isstat2

   relative                    rlerrno               rlstat1  rlstat2

   sequential                  sqerrno               sqstat1  sqstat2

   line sequential             lserrno               lsstat1  lsstat2


    o  errors associated with the operating system will show the operating
       system error variable, errno. For more information consult your
       operating system documentation.

   For general information on errors see the section "Error Conditions".

   Note that the fhvalidate utility gives various information messages, and
   these are documented in the section Validation Information Messages in
   the chapter File Handler Utilities earlier in this manual.


   Utility Error Messages
   ======================

   Block size specified more than once

    o  This message is followed by the invalid parameter record.

       You have included more than one record specifying the block size in
       the parameter file.

   Cannot build isam file filename (iserrno = )

    o  You cannot build the indexed file <filename>, because either you do
       not have permission to create a file in the current directory, or
       there is an error in the information to convert or create the file.

   Cannot build line sequential file filename (lsstat1/lsstat2)

    o  You cannot build the line sequential file <filename>, because either
       you do not have permission to create a file in the current directory,
       or there is an error in the information to convert or create the
       file.

   Cannot build relative file filename (rlstat1/rlstat2)

    o  You cannot build the relative file <filename>, because either you do
       not have permission to create a file in the current directory, or
       there is an error in the information to convert or create the file.

   Cannot build sequential file filename (sqstat1/sqstat2)

    o  You cannot build the sequential file <filename>, because either you
       do not have permission to create a file in the current directory, or
       there is an error in the information to convert or create the file.

   Cannot delete file filename (iserrno = /status1 & 2)

    o  You cannot delete the file <filename>, for one of the following
       reasons:

        o  the file does not exist

        o  you do not have permission to delete the file

        o  the file has been locked by another user.

   Cannot initialize correct language support

    o  This message is produced only by systems supporting NLS.

   Cannot open configuration file filename (errno)

    o  The configuration file <filename> either is not in the current
       directory or is in some other way inaccessible.

   Cannot open file filename (iserrno/status1 & 2)

    o  The file <filename> cannot be opened for one of the following
       reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user.

   Cannot open isam file filename (iserrno)

    o  The indexed file <filename> cannot be opened for one of the following
       reasons:

        o  the file does not exist

        o  you do not have permission to open the file
        o  the file has been locked by another user.

   Cannot open line sequential file filename (lsstat1/lsstat2)

    o  The line sequential file <filename> cannot be opened for one of the
       following reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user.

   Cannot open parameter file <filename> (errno)

    o  The parameter file filename cannot be opened for one of the
       following reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user.

   Cannot open relative file filename (rlstat1 rlstat2)

    o  The relative file <filename> cannot be opened for one of the
       following reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user

   Collating sequence specified more than once

    o  You have specified the same collating sequence more than once in the
       parameter file.

   Cannot open sequential file filename (sqstat1 sqstat2)

    o  The sequential file <filename> cannot be opened for one of the
       following reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user.

   Configuration file exists

    o  The utility you are using needs to create a configuration file.
       However, this file already exists and the process cannot, therefore,
       continue.

    o  You could try the process again, this time including the -r flag in
       the command line, which will delete any existing configuration file.

   Error encountered while adding an index filename (iserrno)

    o  The utility could not add the index to the file <filename>. This
       could be because the key already exists. No index has been added.

   Error encountered while deleting an index filename(iserrno)

    o  The index you wanted to delete from the file <filename> has not been
       deleted. This may be because you tried to delete the primary index.

   Error encountered while linking file filename (errno)

    o  When you are rebuilding a file, the utility makes a copy of the file
       <filename>, and for some reason this has been unsuccessful. The file
       cannot be rebuilt.

   Error encountered while obtaining file information filename(iserrno)

    o  The utility has failed to obtain file information from the file
       <filename>. This could be because the file is corrupt, or has been
       locked by another user.

   Error encountered while reading the file filename (iserrno/status1& 2)

    o  The file <filename> cannot be read for one of the following reasons:

        o  the file does not exist

        o  you do not have permission to open the file

        o  the file has been locked by another user

        o  the file is corrupt

        o  you have used the wrong parameters to describe the file

   Error encountered while unlinking the file filename(errno)

    o  When converting a file the utility constructs a duplicate file. For
       some reason the file <filename> cannot be removed.

   Error encountered while writing the file filename (iserrno/status1& 2)

    o  Information cannot be written to the file <filename> because the file
       is corrupt, or has been locked by another user or is in some other
       way inaccessible.

   File name specified more than once

    o  This message is followed by the invalid parameter record.

       You have included more than one record giving the file name in the
       parameter file.

   File type specified more than once

    o  This message is followed by the invalid parameter record.

       You have included more than one record giving the file type in the
       parameter file.

   Fixed and variable record length specified for input file

    o  This message is followed by the invalid parameter record.

       You have given a record length for a fixed length file as well as for
       a variable length file for the input file. You can only specify one
       of these for a file. The file can be either fixed length or variable
       length but not both.

   Fixed and variable record length specified for output file
    o  This message is followed by the invalid parameter record.

       You have given a record length for a fixed length file as well as for
       a variable length file for the output file. You can only specify one
       of these for a file. The file can be either fixed length or variable
       length but not both.

   Fixed record length specified more than once

    o  This message is followed by the invalid parameter record.

       You have included more than one record giving the length of record
       for a fixed length file in the parameter file.

   Illegal configuration filename filename (errno)

    o  A configuration file has been specified with an illegal filename.

   Illegal flag flag

    o  The flag you have used in the command line is not valid for the
       utility you are using.

   Illegal parameter filename filename (errno)

    o  The name you have used for the parameter file <filename> is not valid
       for your operating system.

   Incorrect permissions on configuration file filename(errno)

    o  The specified configuration file cannot be accessed due to illegal
       permissions.

   Incorrect specification of collating sequence

    o  The collating sequence you specified in the parameter file is not
       recognized by the system.

   Incorrect permissions, or file is locked filename (iserrno)

    o  You either do not have permission for the operation you are trying to
       perform on the file <filename>, or the file has already been locked
       by another user.

   Incorrect specification of block size

    o  This message is followed by the invalid parameter record.

       The block size you have given in the parameter file is not valid.

   Incorrect specification of input record delimiter record

    o  This message is followed by the invalid parameter record.

       The value of the input file record delimiter you have given in the
       parameter file is invalid.

   Incorrect specification of output record delimiter

    o  This message is followed by the invalid parameter record.

       The value of the output file record delimiter you have given in the
       parameter file is invalid.

   Incorrect specification of NLS language
    o  This message is followed by the invalid parameter record and is only
       produced by systems supporting NLS.

   Input extension specified more than once

    o  This message is followed by the invalid parameter record.

       You have specified more than one .dat extension for an input file.

   Input file name (IN) illegal

    o  This message is followed by the invalid parameter record.

       The name you have used for the input file is invalid for your
       operating system.

   Input file type (IT) illegal

    o  This message is followed by the invalid parameter record.

       The type of file you have specified for the type of input file either
       does not exist, or is invalid for the utility you are using.

   Input file. Minimum record length > maximum recordlength

    o  This message is followed by the invalid parameter record.

       The information you have given in the parameter file regarding the
       input file is invalid, the minimum record length exceeds the maximum
       record length.

   Input name and Output name should not be identical

    o  You cannot use the same filename for the input file and the output
       file when using this utility.

   Input record delimiter specified more than once

    o  This message is followed by the invalid parameter record.

       You have given more than one record for the record delimiter in the
       input file specified in the parameter file.

   Input record length not specified

    o  You have not included a record for the record length for the input
       file in the parameter file.

   INTERNAL ERROR: Illegal function pointer

    o  This is the result of an internal system error. You should contact
       Technical Support.

   Invalid block size, only 4095/1023/511 are supported

    o  This message is followed by the invalid parameter record.

       You have used an invalid block size in your parameter file.

   Invalid definition of file type

    o  This message is followed by the invalid parameter record.

       The type of file you have specified in the parameter file either does
       not exist or is invalid for the utility you are using.
   Invalid definition of fixed record length

    o  This message is followed by the invalid parameter record.

       The fixed record length you have included in the parameter file is
       invalid.

   Invalid definition of variable record lengths

    o  This message is followed by the invalid parameter record.

       The variable record length you have included in the parameter file is
       invalid.

   Invalid key description

    o  This message is followed by the invalid parameter record.

       The key description you have included in the parameter file either is
       missing or does not contain the correct values.

   Invalid key type

    o  This message is followed by the invalid parameter record.

       The key type specified in the key description is not valid.

   Line sequential file can only be opened/built variable length

    o  You have specified a fixed record length for a line sequential file,
       this is invalid and must be changed to variable length.

   Memory allocation error (errno)

    o  There is not enough memory to run the utility.

   NLS language specified more than once

    o  This message is followed by the invalid parameter record.

       You have specified more than one NLS type record in the parameter
       file.

   Null or illegal file name specified for use with the '-f' flag

    o  You have included the -f flag in your command line, this must be
       followed by the name of a file. You have either failed to include a
       filename, or the name you have used is not valid for the operating
       system you are using.

   Null or illegal file name specified for use with the '-p' flag

    o  You have included the -p flag in your command line, this must be
       followed by the name of a file. You have either failed to include a
       filename, or the name you have used is not valid for the operating
       system you are using.

   Output extension specified more than once record

    o  This message is followed by the invalid parameter record.

       You have specified more than one .dat extension for the output file
       in the parameter file.

   Output file. Minimum record length > maximum recordlength
    o  This message is followed by the invalid parameter record.

       The information you have given in the parameter file regarding the
       output file is incorrect, the minimum record length exceeds the
       maximum record length.

   Output file name (ON) illegal

    o  This message is followed by the invalid parameter record.

       The name of the output file you have given in the parameter file is
       invalid for your operating system.

   Output file type (OT) illegal

    o  This message is followed by the invalid parameter record.

       The type of output file you have specified in your parameter file
       either does not exist or is invalid for the utility you are using.

   Output record delimiter specified more than once

    o  This message is followed by the invalid parameter record.

       You have specified more than one record for the record delimiter for
       the output file in the parameter file.

   Output record length not specified

    o  You have failed to give the record length for the output file
       specified in the parameter file.

   Parameter file not specified

    o  You have not given the name of the parameter file you want to use
       with the utility in the command line.

   Prime key description specified more than once

    o  This message is followed by the invalid parameter record.

       You have given more than one prime key description in a parameter
       file. An indexed file can only have one prime key.

   Unrecognised parameter in parameter file

    o  This message is followed by the invalid parameter record.

       You have included a record in your parameter file that is not
       recognized by the utility you are using.

   Utility not supported

    o  You will see this message if you have renamed one or more of the
       files holding the utility program. You can only invoke the utilities
       using the names given in the chapter File Handler Utilities earlier
       in this manual.

   Variable record length specified more than once

    o  This message is followed by the invalid parameter record.

       You have given more than one record in the parameter file for the
       length of record in a variable length file.

   File-specific Error Codes
   =========================
   Certain errors are associated only with C-ISAM and X/Open compliant
   files. Other errors are associated mainly with other types of indexed
   files (LEVEL II COBOL and the indexed format supported by this COBOL
   system) plus relative, sequential and line sequential files. Therefore,
   the following sections are divided between C-ISAM and X/Open compliant
   files and other file types. Using C-ISAM and X/Open compliant files, the
   error numbers are important, whilst for the remaining file types only the
   status codes are significant.


   Errors Associated with C-ISAM and X/Open Files
   ----------------------------------------------
   Error numbers are from -1 to 99 for operating system errors and greater
   than 99 for other errors. If the error is from the operating system, you
   must check the errors associated with that system. Unlike the other file
   types, the errors are identified by the error number, rather than the
   status codes.

   The following errors numbers identify the following X/Open and C-ISAM
   errors:

   100 EDUPL  Duplicate record

    o  You tried to add a duplicate value to an index with no duplicates
       allowed, or to add an index with no duplicates allowed where there
       are duplicate values for the key in the file.

   101 ENOTOPEN  File not open

    o  The file you attempted to access is not open, or you did not open it
       with the appropriate access mode for the call made.

   102 EBADARG  Illegal argument

    o  The argument you have given for the call is outside the valid range.

   103 EBADKEY  Illegal key description

    o  The key description you have given has one or more values outside the
       valid range.

   104 ETOOMANY  Too many files open

    o  You have tried to exceed the maximum number of indexed files which
       can be open at any one time.

   105 EBADFILE  Bad isam file format

    o  The index information for the file has been corrupted so that the
       data is no longer accessible.

    o  To rebuild the file you can use the File Handler utilities, for more
       information see the section fhrebuild Utility in the chapter File
       Handler Utilities earlier in this manual.

   106 ENOTEXCL  Non-exclusive access

    o  You cannot add or delete an index because you have not opened the
       file in exclusive mode.

   107 ELOCKED  Record locked

    o  You cannot access the record specified by your call because the
       record has been locked by another user.
   108 EKEXISTS  Key already exists

    o  You have tried to add an index that already exists.

   109 EPRIMEKEY  Is primary key

    o  You have tried to delete the primary key value. You cannot delete
       this using the isdelindex call.

   110 EENDFILE  End/begin of file

    o  You have reached the end or beginning of the file.

   111 ENOREC  No record found

    o  No record can be found in the position you have specified, or by the
       value given for isrecnum.

   112 ENOCURR  No current record

    o  The call you have made operates on the current record, but either no
       record has been defined, or the current record has been deleted. To
       define a current record you should make an isread call to the file.

   113 EFLOCKED  File locked

    o  The file you want to access has either been exclusively locked by
       another user, or you are attempting to gain an exclusive lock on a
       file which is already open by another user.

   114 EFNAME  File name too long

    o  The filename you have given is either too long or is in some way
       invalid. You should check your operating system documentation to
       ensure you know the correct filename format.

   115 ENOLOCK  Can't create lock file

    o  The lock you have specified for the file cannot be used.

   116 EBADMEM  Can't allocate memory

    o  There is not enough memory available to perform the call you have
       made.

   117 EBADCOLL  Bad custom collating

    o  The collating sequence specified in the key description is invalid.

   120 EBADNLS  Bad NLS language

    o  You have tried to open a file that was created using a different NLS
       language to the one you are trying to use.

   Errors for Remaining File Types
   ===============================
   These error messages apply to LEVEL II indexed files and the indexed file
   format supported by this COBOL system, relative files, sequential and
   line sequential files. The errors are identified by the status values
   rather than the error number. Generally, the error number will be set to
   zero if the call is successful, or -1 if the call fails.

   If the error number is set to -1 the appropriate values are returned to
   the status variables: status1 and status2. There are two significant
   settings for status1:
   -------------------------------------------------------------------------
   Setting          Description
   -------------------------------------------------------------------------
   5                     points to certain indexed errors

   9                     points to errors for all file types including
                         indexed.


   The error messages produced when status1 is set to 5 and 9 are detailed
   in the following sections.


   When status1 is Set to 5
   ------------------------
   Errors only associated with indexed files set status1 to 5, then status2
   to one of the following:

   1        No Such Index

    o  The key description you have given has one or more values outside the
       acceptable range.

   2        Index already exists

    o  You have tried to add an index that already exists.

   3        Prime index

    o  You have tried to delete the primary key value. You cannot delete
       this using the isdelindex call.

   4        Not exclusive

    o  You cannot add or delete an index because you have not opened the
       file in exclusive mode.

   5        Duplicates present

    o  The key used in the call permits duplicates.

   6        Too many keys

    o  You have tried to add more keys than the maximum permissible.


   When status1 is Set to 9
   ------------------------
   Errors associated with all file types set status1 to 9.

   Status2 is set to one of the following values, which indicates the type
   of error:

   002      File not open when access attempted

    o  You have tried to access a file that you have not opened.

   005      Illegal device specification

    o  Devices to which you can write are defined by the operating system.
       You have attempted to access a device which is not defined by your
       system.

   006      Attempt to write to a file opened for INPUT

    o  You have tried to write to a file which you opened for INPUT only.

    o  You will need to close the file, and use the open call, making sure
       you open it in a compatible mode, for example I-O.

   007      Disk space exhausted

    o  There is no room available on your current disk for file operations.

   008      Attempt to input from a file opened for OUTPUT

    o  You have tried to read a file which you have opened for OUTPUT only.

    o  You will have to close the file, and use the open call in the correct
       mode, for example I-O.

   009      No room in file system

    o  There is no room available for further file operations in the file
       system you have specified.

   012      Attempt to open a file which is already open

    o  You have tried to open a file that you have opened with a previous
       call. You cannot open the same file more than once from within the
       same process.

    o  Note that the call to build a file also opens a file.

   013      File not found

    o  The operating system cannot find the file you are trying to access in
       your program.

   014      Too many files open simultaneously

    o  You have tried to exceed the maximum number of files which you can
       have open at any one time. This is an operating system restraint and
       you must not violate it.

   015      Too many indexed files open

    o  You have tried to exceed the maximum number of indexed files which
       you can have open at any one time. This is either a software or an
       operating system restraint and you must not violate it.

   016      Too many device files open

    o  You have tried to exceed the maximum number of device files which you
       can have open at any one time. This is either a software or an
       operating system restraint and you may not violate it.

   017      Record error: probably zero length

    o  You have tried to access a record that has no value in it.

   018      Read part record error: eof before eor or file open inwrong mode

    o  A part record has been found at the end of the file.

   019      Rewrite error: open mode or access mode wrong

    o  You have tried to rewrite a record in a file that has not been opened
       in the correct mode for this operation.

    o  You should close the file, then open it again using the correct mode,
       for example I/O.

   020      Device or resource busy

    o  You have tried to open a file that is assigned to a device or
       resource that is not available at this time.

   021      File is a directory

    o  You have tried to write a record to a directory instead of a file.

    o  Change your program giving the correct filename.

   024      Disk input-output error

    o  This error is given if:

        o  you use the read call after writing to a file

        o  there is a verification failure or a parity error.

   026      Block I-O error

    o  An error occurred while you were attempting to access a disk. This
       could be the result of a corrupt disk.

   027      Device not available

    o  You have tried to access a device which is either not attached to
       your machine or, if attached, is not on-line.

   028      No space on device

    o  You have tried a file operation for which there is not enough space
       on your device.

   029      Attempt to delete open file

    o  You have tried to delete an open file.

    o  Close the file before trying to delete it.

   030      File system is read-only

    o  You have tried to change information in a file that has read only
       permissions. A read only file enables you to read information from a
       file, but not to alter it in any way.

   031      Not owner of file

    o  You do not have the authority to perform the call you have made to
       the file.

    o  Abandon the call, unless you are given access by the file's owner.

   032      Too many indexed files, or no such process

    o  You have tried to open an indexed file, but the number of files you
       have open is the system limit.

    o  Close some indexed files you are no longer accessing.

   033      Physical I-O error

    o  You have a hardware error of some type, or you may have tried to
       write to a disk but the processor detected a hardware interface
       problem, so the call has failed.

   034      Incorrect mode or file descriptor

    o  You have either tried to write to a file that is open for INPUT only,
       or read a file that is open for OUTPUT only.

    o  Close the file and open it again with the valid open mode.

   035      Attempt to access file with incorrect permission

    o  You have tried a file operation for which you do not have valid file
       access permissions.

    o  If you are the file owner, change the file attributes; otherwise you
       cannot perform the operation on the source file. You could, however,
       make a copy of the file.

   036      File already exists

    o  You have tried to perform an inappropriate operation on a file that
       already exists.

   037      File access denied

    o  Your attempt to access the file has been denied by the operating
       system (for example, the file may be write protected).

    o  Alter the access permission to the relevant file to continue.

   039      File not compatible

    o  You have tried to load a file that is not compatible with the
       structure of files under your current release of software.

    o  Create a new copy of the file with the correct structure.

   040      Language Initialization not set up correctly

    o  The NLS language in the file you are using:

        o  has not been set up correctly

        o  does not exist

        o  is invalid.

   041      Corrupt indexed file

    o  The index information for an indexed file has been corrupted so that
       the data is no longer accessible.

   043      File information missing for an indexed file

    o  This message can be generated by either of the following two
       conditions:

        o  if the system crashed on the program's previous run, while the
           file was open. This means information was added to the end of the
           file, but the index was not updated so the information cannot be
           accessed by your system

        o  you copied an indexed file from one disk to another without
           copying both physical files.

   047      Indexed structure overflow
    o  There is a fault in the structure of your indexed file. You have
       probably tried to put an addition entry in the index when there is no
       room for it.

   065      File locked

    o  You have made an open call to a file that is already locked, or
       opened for OUTPUT only by another user.

   066      Attempt to add duplicate record key to indexed file

    o  You have tried to add a duplicate key to the index of an indexed file
       which does not allow duplicate keys.

    o  Redefine the key for this call to succeed.

   067      Indexed file not open

    o  You have tried to access an indexed file which you have not opened.

    o  Open the file so that you can access information.

   068      Record locked

    o  You have tried to access a record which is currently locked by
       another user.

   069      Illegal argument to ISAM module

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   070      Too many indexed files open

    o  You have tried to open an indexed file; however the system limit for
       open indexed files has been reached.

   071      Bad Indexed file format

    o  There are two reasons for this error message:

        o  the file has been corrupted

        o  there is an internal system error, in which case you should
           contact Technical Support.

   072      End of indexed file

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   073      No record found in indexed file

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   074      No current record in indexed file

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   075      Indexed data file name too long

    o  The name of the file has too many characters for your operating
       system.

    o  Check your operating system documentation to make sure you are using
       the permitted number of characters for the filenames.

   077      Internal ISAM module error

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   078      Illegal key description in indexed file

    o  The key description you have given is one or more values outside the
       acceptable range.

   081      Key already exists in indexed file

    o  You have tried to add an index that already exists.

   100      Invalid file operation

    o  The most likely cause of this error is that you have tried a REWRITE
       operation on a file which has failed because the record to be
       rewritten has not been set as the current record.

    o  Set the record you want to rewrite as the current record by first
       making a READ call to the record.

   101      Illegal operation on an indexed file

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   102      Sequential file with non-integral number of records

    o  There are three possible reasons for this error:

        o  you have specified an incorrect record length for a sequential
           file

        o  the sequential file you have tried to access is corrupt in some
           way

        o  the file you have specified is not a sequential file.

   105      Memory allocation error

    o  There is not enough memory available to perform the attempted
       operation.

    o  Obtain more memory to run your program. Refer to your operating
       system documentation for details.

   106      Dictionary error

    o  There are two possible reasons for this error message:

        o  a READ or WRITE error to file or disk

        o  an internal system error, in which case you should contact
           Technical Support.
   109      Invalid checksum in the Run-Time System

    o  This is the result of an internal system error.

    o  Contact Technical Support.

   116      Cannot allocate memory

    o  There is not enough memory to execute your code.

   117      Bad collating sequence

    o  The collating sequence specified in the key description is not valid.

   129      Attempt to access record zero of relative file

    o  The value you specified in rlrecnum contains the value zero.

    o  Ensure the value in rlrecnum is equal to the record you want to
       access.

   135      File must not exist

    o  You have tried to open for OUTPUT a file that already exists.

    o  Either open the file for I-O, or supply a new filename for the file
       to be opened for output.

   139      Record length or key data inconsistency

    o  There is a discrepancy in either the length of a record, or the keys
       which you have specified in your current program compared to the call
       you used to open the file.

   141      File already open - cannot be opened

    o  You have tried to open a file which is already open. You cannot open
       a file more than once from within the same process.

   142      File not open - cannot be closed

    o  You have tried to close a file which was not open.

   143      Rewrite in sequential mode not preceded by successful read

    o  The current record is undefined because you have not read the record
       first. You have tried to rewrite the record but as the current record
       is undefined, the system cannot find the start of the record you want
       to rewrite.

    o  Read the file first, which defines the current record. You can then
       rewrite it.

   146      No current record defined for sequential read

    o  The current record is undefined because of a failed READ operation,
       START operation or invalid key condition. You have tried to read
       another record in the file, but as the current record is undefined
       the system cannot find the start of the record for which you have
       asked.

    o  Perform a START or READ operation on the file to define the current
       record.

   147      Wrong open mode or access mode for read/start
    o  You have tried to read or start a file which has not been opened in
       INPUT or I-O mode, or is not open at all.

   148      Wrong open mode for write

    o  You have tried to write to a file that you have not opened in the
       correct mode for output.

    o  Close the file and open it in the correct mode.

   149      Wrong open mode for rewrite/delete

    o  You have tried to rewrite or delete a record in a file that you have
       not opened in I-O mode.

    o  Close the file and open it again in I-O mode.

   150      Program abandoned at user request

    o  You have stopped the program using a keyboard interrupt. The program
       closed tidily, and any open files were closed.

   151      Random read on sequential file

    o  You have tried to randomly read a file which has a sequential
       organization.

    o  Use the correct READ operation for the file.

   152      Rewrite on file not open I-O

    o  You have tried to rewrite a record in a file that is not opened in
       the I-O mode.

   158      Attempt to rewrite to a line sequential file

    o  You have tried to rewrite to a file using the Isrewcurr call. You can
       only use this call if the record you are rewriting is the same size
       as the original record.

   159      Malformed line sequential file

    o  The line sequential file you tried to access is corrupt.

   165      Version number incompatibility

    o  The version of the File Handler you are using is not compatible with
       the Run-Time System.

    o  Make sure you are using the correct versions of software.

   180      End of file marker error

    o  A file marker used to indicate that the end-of-file has been reached
       is missing from the file.

   181      Invalid parameter error

    o  The parameter you have specified is not valid.

   188      File name too large

    o  The name of the file has too many characters for your operating
       system.

    o  Check with your operating system documentation to make sure you are
       using the correct number of characters for the filenames.

   194      File size too large

    o  The file which your program is accessing is too large for successful
       execution to continue.

    o  Spread the data over more than one file.

   196      Record number too large in relative or indexed file

    o  There are three possible causes for this error:

        o  the relative record key has exceeded the limit; that is, the file
           is too large for the system to process

        o  the record key that you have specified is too large for the
           system to process

        o  the pointer to the record has been corrupted in some way so that
           it is either too large, or is not a multiple of the record
           length.

   199      Operating system error out of defined range

    o  A system call has returned an unexpected error number which is not
       documented.

    o  Contact Technical Support.

   200      Run-Time system internal logic error

    o  There are two causes for this error:

        o  the amount of memory available is too low to load the run-time
           system

        o  the Run-Time System has halted due to an internal logic error in
           your program.

    o  In the first case, freeing extra memory should remedy the problem.
       However, in the case of the second problem you should contact
       Technical Support.

   213      Too many locks

    o  The file has already acquired the maximum number of locks for a file
       allowed by your operating system.

   219      Operating system shared file limit exceeded

    o  You have tried to exceed your operating system's limit on the number
       of shared files that you can have open simultaneously.

    o  As this figure is operating system dependent, consult your operating
       system documentation for details of how many shared files your system
       permits to be open at any one time.


   =========================================================================
   Micro Focus is a registered trademark of Micro Focus Limited.
   Micro Focus COBOL and OSX are trademarks of Micro Focus Limited.
   C-ISAM is a trademark of Informix Software Incorporated.
   OS/2 is a registered trademark of International Business Machines
   Corporation.
   Windows is a trademark of Microsoft Corporation.
   UNIX is a registered trademark of X/Open Company Limited.
   X/Open is a registered trademark of X/Open Company Limited.
   =========================================================================
   @(#)Vrn/fhut/3.4.02/4.0.03/12Jun96/nrV
   Copyright (C) 1993-96 Micro Focus Limited

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026