Standard File Header

The first record in every variable structure file is a system record called the file header. This is normally 128 bytes in length and takes the following form:

Offset Size Description
0 4 Length of the file header. The first 4 bits are always set to 3 (0011 in binary) indicating that this is a system record. The remaining bits contain the length of the file header record, unless the file is an indexed file type that does not include a separate index file (such as IDXFORMAT8); for those types of file, see Index File - File Header. If the maximum record length is less than 4095 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".

An exception to this is the header of C-ISAM files, for which the field contains "30 00 03 FC".

4 2 Database sequence number, used by add-on products.
6 2 Integrity flag. Indexed files only. If this is non-zero when the header is read, it indicates that the file is corrupt.
8 14 Creation date and time in YYMMDDHHMMSSCC format.
22 14 For internal use.
36 2 For internal use.
38 1 For internal use.
39 1 Organization:
  1. Sequential
  2. Indexed
  3. Relative
40 1 For internal use.
41 1 Data compression routine number:
0
No compression
1
CBLDC001
2-127
Reserved for internal use
128-255
User-defined compression routine number
42 1 For internal use.
43 1 Indexed files only - type of indexed file.
44 4 For internal use.
48 1 Recording mode:
0
Fixed format
1
Variable format

For indexed files, the recording mode field of the .idx file takes precedence.

49 5 For internal use.
54 4 Maximum record length. Example: with a maximum record of length 80 characters, this field will contain x"00 00 00 50".
58 4 Minimum record length. Example: with a minimum record length of 2 characters, this field will contain x"00 00 00 02".
62 46 For internal use.
108 4 Version and build data for the indexed file handler creating the file.
112 16 For internal use.