HP 3000 Manuals

Operation [ COBOL/HP-UX Operating Guide for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Operating Guide for the Series 700 and 800

Operation 

There are three basic structures used for all files:  line sequential,
fixed and variable.

Line sequential is the structure of files with the line sequential
organization.  It contains variable length records with trailing spaces
removed.

Fixed is the structure used by fixed format sequential and relative
files, and contains only fixed length records.

Variable is the structure of variable format sequential and relative
files, and fixed and variable format indexed sequential files.  Variable
structure files can contain fixed or variable length records.

The following sections describe these file formats.

Fixed and Variable Format 

The format of a file is determined by the RECMODE directive and the FD
clauses RECORDING MODE, RECORD CONTAINS n CHARACTERS and RECORD IS
VARYING. The RECORDING MODE clause overrides the RECORD clause which, in
turn, overrides the RECMODE directive.  The clause RECORD CONTAINS a TO b
CHARACTERS does not affect the format. 

Hence:

   *   RECORDING MODE IS V always creates variable format.

   *   RECORDING MODE IS F always creates fixed format.

   *   RECORD CONTAINS a TO b CHARACTERS has no effect on file format.

   *   RECORD IS VARYING creates variable format provided no RECORDING
       MODE IS F clause is present.

   *   RECORD CONTAINS n CHARACTERS creates fixed format provided no
       RECORDING MODE IS V clause is present.

   *   RECMODE"F" creates fixed format for each file where no RECORDING
       MODE IS V or RECORD IS VARYING clauses are present.

   *   RECMODE"V" creates variable format for each file where no
       RECORDING MODE IS F or RECORD CONTAINS n CHARACTERS clauses are
       present.

   *   RECMODE"OSVS" causes the 01 definitions to determine if the file
       is fixed or variable format.

Fixed Structure 

Fixed structure files contain no 
record or file header information.  The records are all the same length,
that length being determined by the longest record defined in the File
Description (FD) in the program's FILE-SECTION.

Variable Structure 

Any files containing variable length records, with the exception of line
sequential files and files destined for the printer, contain a block of
128 bytes of header information at the start of the file.  In indexed
files, extra space is allocated in addition to this for blank index
pointers.  Each record in the file is preceded by a 2- or 4-byte control
field.  The top 4 bits of this field indicate the status of the record.
A value of 0100 in these bits means that this record is a user data
record.  Any other value means that this record has either been deleted
or is used internally.  The remainder of the control field contains the
length of the record.

For all files where the maximum record size is less than 4096 (excluding
the prefix), the prefix is 2 bytes long.  For all other files, the prefix
is 4 bytes long.  Each record always starts on the next 4 byte boundary
in the file.

You must not alter the header information or the control fields in any
way since these are maintained by this COBOL system.

Record Header Types 

First 4 bits   Record type 

1 (0001)       A system record (Idxformat 4 files only) This contains
               duplicate occurrence details in the data file.

2 (0010)       Deleted record (available for reuse)

3 (0011)       System record

4 (0100)       User data record

5 (0101)       Reduced user data record (indexed files only) The 16-bit
               word immediately following the data record, as indicated
               by the length in the header, contains the space between
               the end of the data record and the start of the next
               record header

6 (0110)       Pointer record (indexed files only) The first 4 bytes
               following the record header contain the offset in the file
               to the location of the user data record

7 (0111)       User data record referenced by a Pointer record

8 (1000)       Reduced user data record referenced by a Pointer record

The first record in every variable structure file is a system record
called the File Header record.  This is normally 128 bytes long.

Variable structure File Header Record description:

-------------------------------------------------------------------

Offset    Size  Description of the field 

-------------------------------------------------------------------

0          4    Length of the file header.

                The first 4 bits are always set to 3 (0011 in
                binary) indicating that this file header record is
                a system record.

                The remaining bits contain the length of the file
                header record.  If the maximum record length is
                less than 4096 bytes, the length is 126 and is held
                in the next 12 bits; otherwise it is 124 and is
                held in the next 28 bits.  Hence, in a file where
                the maximum record length is less than 4095 bytes,
                this field contains x"30 7E 00 00".  Otherwise,
                this field contains x"30 00 00 7C".

4          2    Database sequence number, used by add on products
                from Micro Focus.

6          2    Integrity Flag.  Indexed files only.

                Incremented for every OPEN, decremented for every
                CLOSE. If non-zero when OPEN EXCLUSIVE, indicates
                that the index file is corrupt.

8          14   Creation date and time in YYMMDDHHMMSSCC format.
                Indexed files only.

                This date and time must be the same as the creation
                date and time of index file.

22         14   Last modify date and time in YYMMDDHHMMSSCC format.
                Indexed files only.

                This date and time must be the same as the last
                modify date and time of the index file.

36         2    Reserved.  Value 62 decimal; x"00 3E".

38         1    Not used.  Set to zero.

39         1    Organization.

                     1 = Sequential
                     2 = Indexed
                     3 = Relative

-------------------------------------------------------------------

Offset     Size Description of the field 

-------------------------------------------------------------------

40            1 Not used.  Set to zero.

41            1 Data compression routine number.

                     0       = No compression
                     1       = CBLDC001
                     2-127   = Reserved for Micro Focus use
                     128-255 = User-defined compression routine
                     number

42            6 Not used.  Set to zero.

43            1 File format

                     0 = Default
                     1 = C-ISAM
                     2 = Level II COBOL
                     3 = Micro Focus COBOL
                     4 = IDXFORMAT4

48            1 Recording mode.

                     0 = Fixed format
                     1 = Variable format

                For indexed files, the Recording Mode field of the
                index file takes precedence.

49            5 Not used.  Set to zero.

54            2 Not used.  Set to zero.

56            2 Maximum record length.

                Example:  with a maximum record of length 80 chars
                this field will contain x"00 50".

58            2 Not used.  Set to zero.

60            2 Minimum record length.

                Example:  with a maximum record of length 2 chars
                this field will contain x"00 02".

62           46 Not used.  Set to zeros.

-------------------------------------------------------------------

Offset    Size  Description of the field 

-------------------------------------------------------------------

108        4    Version and build data for the indexed file handler
                CREATING the file.  Indexed files only.  The
                contents of this field are not fixed.  Should you
                wish to manipulate this field directly, you should
                create an indexed file and examine the contents of
                this field to determine the correct contents.

112        4    Version and build data for the indexed file handler
                MODIFYING this file.  Format and contents are same
                as above.  Indexed files only.

116        12   Not used.  Set to zeros.

-------------------------------------------------------------------

The record header for each record starts on a 4-byte boundary.
Consequently, a record may be followed by up to three padding characters,
usually spaces.  These padding characters are not included in the record
length.



MPE/iX 5.0 Documentation