.dbf

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
.dbf
.dbf File Extension.png
Filename extension .dbf
Developed by dBase
Initial release 1983; 35 years ago (1983)
Latest release
7
Website dbase.com

The .dbf file extension represents the dBase database file. The file type was introduced in 1983 with the introduction of dBASE II. The file structure has evolved over the years to include many more features and capabilities and has introduced various other files to help support data storage and manipulation. The current .dbf file level is called Level 7. The .dbf format is supported by a number of database products.

Overview[edit]

The original dBASE database was started by Wayne Ratliff in 1978 and was known as Project Vulcan. At the time the file that held the data was a simple table that could have data added, modified, deleted and printed using ASCII characters set.[1] As the product became more popular, the underlying file type .dbf was expanded and additional files were added to increase the capabilities of the database system. Keep in mind that dBASE is an IDE (integrated development environment), a database system, a compiler, and a database application builder. However, underneath all that is the .dbf file, which is the actual data storage mechanism. If you want to understand the structure at a much lower level, review the Level 5 DOS headers section of this article.

File architecture overview[edit]

Project Vulcan (Level 1) There are no public records on the exact layout of the file the best information at this time is that it was a simple table that allows for adding, deleting, modifying, and printing out ASCII information. It was designed to run on 8-bit machine running CP/M.

dBASE II – MS-DOS (Level 2) was the first major release of Aston-Tate and offered many advancements above and beyond the simple table structure of the original tables found in Project Vulcan.[2]

  • Still written for 8-bit computing
  • Increased the number of fields from 16 to 32
  • Introduced a SORT routine
  • 16-bit version finally released in April 1983 version 2.4

dBASE III – MSDOS (Level 2sh) was now completely focused on 16-bit operations and was introduced in 1.0 was released in June 1984. The underlying dBASE database was still based on an intermediate version of the dBASE II file format. The dBASE III file format is not compatible with the dBASE III+ format.

dBASE III+ – MS-DOS (Level 3) this starts the modern era of dBASE .dbf files. The dBASE III+ was introduced in December 1985 when the product was released.

  • 16-bit version finally released in April 1983 version 2.4

Structure layout of the file type:[3]

dBASE IV – MS-DOS (Level 4)'

  • 1.0 x322 Oct 1988
  • 1.0 x55 Mar 1993 – dBASE Compiler
  • 2.0 x12 Oct 1993 Includes fixes in dBASE IV v2.0 x16 above (not x17 i.e. not VLM compatible, dB5D exe's are compatible). It's also a new version that contain new features not in the V1.0 product:
    • 32-bit generation
    • Auto compiling and linking
    • Smaller .EXE size
    • Menu driver user interface
    • Linker can produce combined .DBO output
    • Linker can produce a .MAP file
    • Compiler supports alternate date formats
    • Support for wildcard character in file names used with command-line switches.

dBASE V – MS-DOS (Level 5)

  • 1.0 x46 Jun 1994

BDE – Borland Database Engine 2.52

This is the last update to the 16-bit version of the Borland Database Engine (BDE). Download and unzip to a temporary folder, and run the SETUP program.[4]

dBASE V – MS-Windows (Level 5)

  • 5.5 b673 Jul 1995

Level 5 DOS headers[edit]

While dBASE has been around for many years, the files themselves seem to be shrouded in mystery. Below is the structure of a database (.dbf) file for dBASE V for MS-DOS.

A database (.DBF) file is composed of a header, data records, deletion flags, and an end-of-file marker. The header contains information about the file structure, and the records contain the actual data. One byte of each record is reserved for the deletion flag.

Database header structure

The header structure, detailed in Table D.l and Table D.2, provides information dBASE for DOS uses to maintain the database file.

Database file header
Byte Contents Meaning
0 1 byte Valid dBASE for DOS file; bits 0-2 indicate version number, bit 3 indicates the presence of a dBASE for DOS memo file, bits 4-6 indicate the presence of a SQL table, bit 7 indicates the presence of any memo file (either dBASE m PLUS or dBASE for DOS)
1–3 3 bytes Date of last update; formatted as YYMMDD
4–7 32-bit number Number of records in the database file
8–9 16-bit number Number of bytes in the header
10–11 16-bit number Number of bytes in the record
12–13 2 bytes Reserved; fill with 0
14 1 byte Flag indicating incomplete transaction[note 1]
15 1 byte Encryption flag[note 2]
16–27 12 bytes Reserved for dBASE for DOS in a multi-user environment
28 1 byte Production .mdx file flag; 0x01 if there is a production .mdx file, 0x00 if not
29 1 byte Language driver ID
30–31 2 bytes Reserved; fill with 0
32–n[note 3][note 4] 32 bytes each Field descriptor array (the structure of this array is shown in Table Database field descriptor bytes)
n +1 1 byte 0x0D as the field descriptor array terminator
  1. ^ The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
  2. ^ If this flag is set to 1, the message Database encrypted appears. Changing this flag to 0 removes the message, but does not decrypt the file.
  3. ^ n is the last byte in the field descriptor array. The size of the array depends on the number of fields in the database file. n is equal to 31 + 32 * (the number of fields).
  4. ^ The maximum number of fields is 255.
Database field descriptor bytes
Byte Contents Meaning
0–10 11 bytes Field name in ASCII (zero-filled)
11 1 byte Field type in ASCII (C, D, F, L, M, or N)
12–15 4 bytes Reserved
16 1 byte Field length in binary[note 1]
17 1 byte Field decimal count in binary
18–19 2 bytes Work area ID
20 1 byte Example
21–30 10 bytes Reserved
31 1 byte Production MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not
  1. ^ The maximum length of a field is 254 (0xFE).

Database records

The records follow the header in the database file. Data records are preceded by one byte: a space (0x20) if the record is not deleted, or an asterisk (0x2A) if the record is deleted. Fields are packed into records without field separators or record terminators. The end of the file is marked by a single byte 0x1A.

You can input ASCII data as indicated in the following table.

Allowable input for each data type
Data type What it accepts
C (Character) All ASCII characters (padded with whitespaces up to the field's length)
D (Date) Numbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
F (Floating point) -.0123456789 (right justified, padded with whitespaces)
L (Logical) YyNnTtFf? (? when not initialized)
M (Memo) All ASCII characters (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
N (Numeric) -.0123456789 (right justified, padded with whitespaces)

Memo fields and the .DBT file[edit]

A memo (.DBT) file consists of blocks numbered sequentially (0,1,2, and so on). SET BLOCKSIZE determines the size of each block. The first block in the memo file, block 0, is the memo file header.

Each memo field of each record in the .DBF file contains the number of the block (in ASCII) where the memo field begins. If the memo field contains no data, the .DBF file contains blanks (0x20) rather than a number.

When data is changed in a memo field, the block numbers may also change, and the number in the .DBF may be changed to reflect the new location.

Unlike dBASE III PLUS, if you delete text in a memo field, dBASE for DOS may reuse the space from the deleted text when you input new text. dBASE IQ PLUS always appended new text to the end of the .dbt file. In dBASE III PLUS, the .DBT file size grew whenever new text was added, even if other text in the file was deleted.

dBASE 7 – MS-Windows (Level 7)

  • 7.0 b1345 Dec 1997 Full 32 bit version for Win 95/NT

Level 7 tables[edit]

Level 7 brought many improvements. The field names can have up to 31 characters (from a maximum of 10 before). Some new fields types have appeared (for example, the auto-increment field[5] that makes nearly impossible to give the same number to two records in the same table). If your tables have to be used by other software, you might have to sacrifice these advantages for the sake of compatibility, as few applications can use a level 7 table.[6]

Level 7 structure[edit]

The Level 7 structure is the latest supported by dBASE and BDE.[7]

BDE version 5.1.0

Significant improvements over the prior releases.[8] There are also some limitations with regards to what the BDE can handle.[9]

Other file types found in dBASE[edit]

There are many file types or files that have extensions that can be used by dBASE. The following list is presented in the order of use. This is a combination list of files that are related to dBASE and is compiled from the dBASE III+, dBASE IV, and dBASE CLASSIC documentation.[10]

Extension File content
.DBF Database file
.DBK Database backup file
.DBO Command and procedure object file
.DBT Database memo file
.DEF Selector definition file
.DEM Define statements for a CUA form
.DIF Data Interchange Format, or VisiCalc file; used with APPEND FROM and COPY TO
.DOC Documentation file; Applications Generator only
.ERR Created if an error occurs during form generation, or if an unrecoverable error occurs
.FIL Files list design object file
.EMO Compiled format (.fmt) file
.FMT Generated format file; from .scr file
.FNL Report binary name list file
.FR3 Renamed old dBASE HI report form (.frm) file
.ERG Generated report form file; from .frm file
.FRM Report form file
.FRO Compiled report form (.ERG) file
.FW2, .FW3, .FW4 Framework spreadsheet or database file; used for import and export
.GEN Template file
.GRP Windows group file for dBASE for DOS
.HLP dBASE for DOS help files
.ICO dBASE for DOS icon file under Windows
.INI Windows-like INI file to save Label Designer and IDE state information.
.KEY Keystroke macro library file
.LB3 Renamed old dBASE III label form (.LBL) file
.LBG Generated label form file; from .LBL file
.LBL Label form file
.LBO Compiled label form (.LBL) file
.LOG Transaction log file
.LNL Label binary name list file
.MBK Multiple index backup file
.MDX Multiple index file
.MEM Memory file
.NDX Single index file
.OVL dBASE for DOS overlay file
PIF Microsoft Windows file for non-Windows applications
.POP Pop-up menu design object file; Applications Generator only
.PR2 Printer driver file
.PRD A file containing printer driver information for DBSETUP
.PRF Print form file
.PRG dBASE command or procedure file
.PRS dBASE SQL command or procedure file
.PRT Printer output file
.QBE QBE query file
.QBO Compiled QBE query (.QBE) file
.QRY dBASE El query file
.RES Resource file
.RPD RapidFile file; used for import and export
.SC3 Renamed old dBASE III screen (.SCR) file
.SCR Screen file
.SNL Screen binary name list file
.STR Structure list design object file; Applications Generator only
.T44/.W44 Intermediate work files; used by SORT and INDEX
.TBK Database memo backup file
.TXT ASCII text output file
.UPD QBE update query file
.UPO Compiled QBE update query (.UPD) file
.VAL Values list design object file; Applications Generator only
.VMC Configuration file; for Virtual Memory Manager (VMM)
.VUE View file
.WIN Logical window save file
.WKS, .WK1 Lotus 1-2-3 file; used with APPEND FROM and COPY TO

See also[edit]

References[edit]

  1. ^ Powell, David B. (1984-02-07). "From Basement To Boardroom". PC Magazine: 131. Retrieved 24 October 2013. 
  2. ^ Powell, David B. (1984-02-07). "From Basement to Boardroom". PC Magazine: 131–135. Retrieved 2014-08-15. 
  3. ^ "dBASE Table File Format (DBF)". Digitalpreservation.gov. Retrieved 2014-08-15. 
  4. ^ "dBASE Documentation Download - dBase, LLC". Dbase.com. Retrieved 2014-08-15. 
  5. ^ Jean-Pierre Martel. "AutoIncrement Fields". Dbase.com. Retrieved 2014-08-15. 
  6. ^ level and language of a table
  7. ^ "dBASE .DBF File Structure". Dbase.com. Retrieved 2014-08-15. 
  8. ^ Jean-Pierre Martel. "New BDE 5.1.0 and Visual dBASE 7.01". Dbase.com. Retrieved 2014-08-15. 
  9. ^ [1]
  10. ^ "dBASE Classic". dBASE Classic. Retrieved 2014-08-15. 

Further reading[edit]

External links[edit]