[net.micro.cpm] Structure of Dbase II Files

BLC%jpl-vax@sri-unix.UUCP (10/02/83)

From:  Bruce L. Conroy <BLC@jpl-vax>

STRUCTURE OF DBASE II FILES

Based on an analysis of several CP/M type data files,
the structure of dBase II files appears to be as follows:

1)   Bytes 0 to 7; General Header
          Byte 0, always 2--Purpose unknown
          Bytes 2-3, number of records, binary, low, hi
          Bytes 4-6, date of last update, (mo, day, year), binary
          Bytes 7-8, number of bytes per record, binary, low, hi

2)   Bytes 8 to 520; Field Headers
     16 Bytes per Field, up to 32 Fields.
     Relative Byte in each Header
          Bytes 0-9, Name, ASCII, padded with NULLS
               (<CR> as first byte marks end of Fields)
          Byte 10, always 0
          Byte 11, Type, ASCII, C N or L
          Byte 12, Width, Binary, 1 for Logical
          Bytes 13-14, 70B9H + Sum of Widths of Preceeding Fields
               (Possibly an in-memory pointer)
          Byte 15, Decimal Places, binary, 0 for C and L Types

3)   Byte 521; Normally 0, <CR> (0DH) in data base with 32
          fields (this would be the first byte of a 33rd field.)

4)   Bytes 522 on; Data, ASCII, Number of Bytes + 1 Bytes per Record
     Each Data record begins with a blank (20H), followed by the
     fields in order, with no intervening blanks or nulls.

Thus the start of the Nth record of a file with BPR bytes  per record
is at byte 522 + (N - 1) * (BPR + 1) + 1.
------