---------------------------------------------------------------------------- genaral format of .dbf files in xbase languages 18-nov-96 ---------------------------------------------------------------------------- applies for / supported by:
fs = flagship d3 = dbaseiii+ fb = foxbase d4 = dbaseiv fp = foxpro d5 = dbasev cl = clipper
1. dbf structure ================
byte description ------+-------------------------------------- 0..n .dbf header (see 2 for size, byte 8) n+1 1st record of fixed length (see 2&3) \ 2nd record (see 2 for size, byte 10) \ if dbf is ... / not empty last record / last optional: 0x1a (eof byte)
2. dbf header (variable size, depending on field count) =======================================================
byte size contents description applies for (supported by) ----+----+--------+----------------------------+----------------------------- 00 1 0x03 plain .dbf fs, d3, d4, d5, fb, fp, cl 0x04 plain .dbf d4, d5 (fs) 0x05 plain .dbf d5, fp (fs) 0x43 with .dbv memo var size fs 0xb3 with .dbv and .dbt memo fs 0x83 with .dbt memo fs, d3, d4, d5, fb, fp, cl 0x8b with .dbt memo in d4 format d4, d5 0x8e with sql table d4, d5 0xf5 with .fmp memo fp 01 3 yymmdd last update digits all 04 4 ulong number of records in file all 08 2 ushort header size in bytes all 10 2 ushort record size in bytes all 12 2 0,0 reserved all 14 1 0x01 begin transaction d4, d5 0x00 end transaction d4, d5 0x00 ignored fs, d3, fb, fp, cl 15 1 0x01 encryptpted d4, d5 0x00 normal visible all 16 12 0 (1) multi-user environment use d4,d5 28 1 0x01 production index exists fp, d4, d5 0x00 index upon demand all 29 1 n language driver id d4, d5 0x01 codepage 437 dos usa fp 0x02 codepage 850 dos multi ling fp 0x03 codepage 1251 windows ansi fp 0xc8 codepage 1250 windows ee fp 0x00 ignored fs, d3, fb, fp, cl 30 2 0,0 reserved all 32 n*32 field descriptor, see (2a) all +1 1 0x0d header record terminator all
2a. field descriptor array in dbf header (fix 32 bytes for each field) ========================================
byte size contents description applies for (supported by) ----+----+--------+----------------------------+----------------------------- 0 11 asci field name, 0x00 termin. all 11 1 asci field type (see 2b) all 12 4 n,n,n,n fld address in memory d3 n,n,0,0 offset from record begin fp 0,0,0,0 ignored fs, d4, d5, fb, cl 16 1 byte field length, bin (see 2b) all \ fs,cl: for c field type, 17 1 byte decimal count, bin all / both used for fld lng 18 2 0,0 reserved all 20 1 byte work area id d4, d5 0x00 unused fs, d3, fb, fp, cl 21 2 n,n multi-user dbase d3, d4, d5 0,0 ignored fs, fb, fp, cl 23 1 0x01 set fields d3, d4, d5 0x00 ignored fs, fb, fp, cl 24 7 0..0 reserved all 31 1 0x01 field is in .mdx index d4, d5 0x00 ignored fs, d3, fb, fp, cl
2b. field type and size in dbf header, field descriptor (1 byte) =======================================================
size type description/storage applies for (supported by) ------+---------+------------------------------+----------------------------- c 1..n char ascii (oem code page chars) all rest= space, not \0 term. n = 1..64kb (using deci count) fs n = 1..32kb (using deci count) fp, cl n = 1..254 all d 8 date 8 ascii digits (0..9) in the all yyyymmdd format f 1..n numeric ascii digits (-.0123456789) fs, d4, d5, fp variable pos. of float.point n = 1..20 n 1..n numeric ascii digits (-.0123456789) all fix posit/no float.point n = 1..20 fs, fp, cl n = 1..18 d3, d4, d5, fb l 1 logical ascii chars (yynnttff space) fs, d3, fb, fp, cl ascii chars (yynnttff ?) d4, d5 (fs) m 10 memo 10 digits repres. the start all block posit. in .dbt file, or 10spaces if no entry in memo v 10 variable variable, bin/asc data in .dbv fs 4bytes bin= start pos in memo 4bytes bin= block size 1byte = subtype 1byte = reserved (0x1a) 10spaces if no entry in .dbv p 10 picture binary data in .ftp fp structure like m b 10 binary binary data in .dbt d5 structure like m g 10 general ole objects d5, fp structure like m 2 2 short int binary int max +/- 32767 fs 4 4 long int binary int max +/- 2147483647 fs 8 8 double binary signed double ieee fs
3. each dbf record (fix length) ==================
byte size description applies for (supported by) ------+----+--------------------------------------+-------------------------- 0 1 deleted flag "*" or not deleted " " all 1..n 1.. x-times contents of fields, fixed all length, unterminated. for n, see (2) byte 10..11
--- multisoft datentechnik gmbh
|