.dbf explained

.dbf
Extension:.dbf
Developer:dBase
Latest Release Version:7
Standards:-->

The .dbf file extension represents the dBase database file. The file type was introduced in 1983 with dBASE II. The file structure has evolved to include many features and capabilities. Several additional file types have been added, to 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

The original dBASE database was known as Project Vulcan and was started by Wayne Ratliff in 1978. At the time the file that held the data was a simple table that could have data added, modified, deleted, or printed using the 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. Despite dBASE being an IDE (integrated development environment), a database system, a compiler, and a database application builder, the original .dbf file was still used for the actual data storage mechanism.

History of the file format

Classical .dbf

Project Vulcan – CP/M (Level 1)
  • There is no publicly available information on the original layout. What is known is that it was a simple table which allowed adding, deleting, modifying, and outputting ASCII data. It was written for 8-bit machines that ran CP/M.
    dBASE II – MS-DOS (Level 2)
  • dBASE II was the first major release by Ashton-Tate. It had many advancements beyond the simple table structures of Project Vulcan.[2]
    dBASE III – MSDOS (Level 2sh)
  • dBASE III (version "1.0"), was released in June 1984. This was a fully 16-bit application. dBASE III's file format is a transitional step between dBASE II and dBASE III+.

    Modern dBASE

    dBASE III+ – MS-DOS (Level 3)
  • dBASE III+ was released in December 1985. It ushered the modern dBASE file format. It is incompatible with dBASE III's file format.[3]
    dBASE IV – MS-DOS (Level 4)
    dBASE V – MS-DOS (Level 5)
  • 1.0 x46 Jun 1994
    BDE – Borland Database Engine 2.52

    This was the last update to the 16-bit version of the Borland Database Engine (BDE).[4]

    dBASE V – MS-Windows (Level 5)

    xBase

    xBase is a name applied to clones of the dBase, typically dBASE III+ - V. Most xBase programs either use the format directly or uses a derived format with custom extensions. Erik Bachmann maintains an open-licensed description of these formats.[5]

    dBASE 7

    The Level 7 structure is the latest supported by dBASE and BDE. It is incompatible with the previous file format, and is supported by few third-party applications.[6]

    dBASE 7 – MS-Windows (Level 7)

    Level 7 brought many improvements. The maximum length for field names increased from 10 to 31 characters. Some new fields types were added, such as the auto-increment field,[7] which prevents creation of duplicate record numbers in the same table.

    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]

    File format of Level 5 DOS dBASE

    The "modern dBASE" III+ - V is the most common dBASE file format found in the wild. In "modern dBASE", a .dbf file consists of a header, the data records, and the end-of-file marker.

    File header

    Layout of file header in dBase level 5
    Byte Contents Meaning
    01 byteValid 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–33 bytesDate of last update; formatted as YYMMDD (with YY being the number of years since 1900)
    4–74 bytes (LE)Number of records in the database file
    8–92 bytes (LE)Number of bytes in the header
    10–112 bytes (LE)Number of bytes in the record
    12–132 bytesReserved; fill with 0
    141 byteFlag indicating incomplete transaction[10]
    151 byteEncryption flag[11]
    16–2712 bytesReserved for dBASE for DOS in a multi-user environment
    281 byteProduction .mdx file flag; 1 if there is a production .mdx file, 0 if not
    291 byteLanguage driver ID
    30–312 bytesReserved; fill with 0
    32–n [12] [13] 32 bytes eacharray of field descriptors (see below for layout of descriptors)
    n + 11 byte as the field descriptor array terminator

    Field descriptor array

    Layout of field descriptors in dBase level 5 (used inside the file header)
    Byte Contents Meaning
    0–1011 bytesField name in ASCII (zero-filled)
    111 byteField type. Allowed values:,,,,, or (see next table for meanings)
    12–154 bytesReserved
    161 byteField length in binary (maximum 254).
    171 byteField decimal count in binary
    18–192 bytesWork area ID
    201 byteExample
    21–3010 bytesReserved
    311 byteProduction MDX field flag; 1 if field has an index tag in the production MDX file, 0 if not

    Database records

    Each record begins with a 1-byte "deletion" flag. The byte's value is a space, if the record is active, or an asterisk, if the record is deleted. Fields are packed into records without field separators or record terminators.

    All field data is ASCII. Depending on the field's type, the application imposes further restrictions:

    Field types in dBase level 5
    Field typeMnemonicWhat it accepts
    CharacterAny ASCII text (padded with spaces up to the field's length)
    DateNumbers and a character to separate month, day, and year (stored internally as 8 digits in YYYYMMDD format)
    Floating point,, – (right justified, padded with whitespaces)
    Logical,,,,,,,, or (when uninitialized)
    MemoAny ASCII text (stored internally as 10 digits representing a .dbt block number, right justified, padded with whitespaces)
    Numeric,, – (right justified, padded with whitespaces)

    Memo fields and the .DBT file

    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, 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 rather than a number.

    When a memo field's content changes, its block number may also change. I.e. the memo gets relocated. In that case, the number in the .DBF file gets updated.

    In dBASE III PLUS, the space consumed by deleted text in a memo field cannot be reused - the .DBT file size grows each time text is added, even if other text has been deleted. dBASE for DOS may reuse that space for new text. dBASE IQ PLUS always appended new text to the end of the .dbt file.

    Other file types found in dBASE

    dBASE defines many types of files. It also recognizes some operating system files and files from other products. The table below lists the most commonly used formats first. It was compiled from the documentation of dBASE III+, dBASE IV, and dBASE CLASSIC.[14]

    File types recognized by dBASE, up to dBASE CLASSIC
    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

    Further reading

    External links

    Notes and References

    1. Powell, David B. . 1984-02-07 . From Basement To Boardroom . PC Magazine . 131 . 24 October 2013 .
    2. From Basement to Boardroom . . Powell . David B. . 1984-02-07 . 2014-08-15 . 131–135.
    3. Web site: dBASE Table File Format (DBF) . Digitalpreservation.gov . 8 October 2012. 2014-08-15.
    4. Web site: dBASE Documentation Download - dBase, LLC . . 2014-08-15.
    5. Web site: Bachmann. Erik. Xbase Data file (*.dbf) . www.clicketyclick.dk.
    6. Web site: dBASE .DBF File Structure . Dbase.com . 2014-08-15.
    7. Web site: Jean-Pierre Martel . AutoIncrement Fields . Dbase.com . 2014-08-15.
    8. Web site: Jean-Pierre Martel . New BDE 5.1.0 and Visual dBASE 7.01 . Dbase.com . 2014-08-15.
    9. Web site: DBase Plus Help 8.
    10. The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 1, END TRANSACTION and ROLLBACK reset it to 0.
    11. 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.
    12. The maximum number of fields is 255.
    13. n means the last byte in the field descriptor array. The array's size depends on the number of fields used in a database. n is equal to 31 + 32 * (number of fields).
    14. Web site: dBASE Classic. dBASE Classic . 2014-08-15.