BLC%jpl-vax@sri-unix.UUCP (10/02/83)
From: Bruce L. Conroy <BLC@jpl-vax> After additional analysis, I have found several typos and ambiguities in the dBase II file structure I sent out before. Here is a corrected version. Please accept my apologies for the former errors. 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 1-2, number of records, binary, low, hi Bytes 3-5, date of last update, (mo, day, year), binary Bytes 6-7, number of bytes per record, binary, low, hi (This is the number reported as TOTAL by DISP STRU, it is one more than the sum of the field widths due to the extra blank added to each record.) 2) Bytes 8 to 519; 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 520; Normally 0, <CR> (0DH) in data base with 32 fields (this would be the first byte of a 33rd field.) 4) Bytes 521 on; Data, ASCII, Number of Bytes 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 BPR (bytes per record) is 1 plus the sum of the widths. Thus the start of the Nth record (starting at 0) of a file with BPR bytes per record is at byte 521 + N * BPR + 1. 5) End of data is marked by ^Z (1AH) instead of blank in the first position. ------