.dbf

From Infogalactic: the planetary knowledge core
Jump to: navigation, search
.dbf files
.dbf File Extension.png
Developer(s) dBase
Stable release 7
Operating system Windows
Platform x86
Type database file format
License Commercial proprietary software
Website www.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

Lua error in package.lua at line 80: module 'strict' not found. 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

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 88
  • 1.0 x55 Mar 93 – dBASE Compiler
  • 2.0 x12 Oct 93 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 wild-card character in file names used with command-line switches.

dBASE V – MS-DOS (Level 5)

  • 1.0 x46 Jun 94

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 95

Level 5 DOS Headers

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 (1)
15 1 byte Encryption flag (2)
16-27 12 bytes Reserved for dBASE for DOS in a multi-user environment
28 1 byte Production .mdx file flag; 01H if there is a production .mdx file, 00H if not
29 1 byte Language driver ID
30-31 2 bytes Reserved; fill with 0
32-n (3) n +1 32 bytes each 1 byte Field descriptor array (the structure of this array is shown in Table Database field descriptor bytes) ODH as the field terminator
  • 1. The ISMARKEDO function checks this flag. BEGIN TRANSACTION sets it to 01, END TRANSACTION and ROLLBACK reset it to 00.
  • 2. If this flag is set to 01H, the message Database encrypted appears. Changing this flag to 00H 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.

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
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; 01H if field has an index tag in the production MDX file, OOH if not

Database records

The records follow the header in the database file. Data records are preceded by one byte; that is, a space (20H) if the record is not deleted, an asterisk (2AH) 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, with the end-of-file marker an ASCII 26 (1AH) character.

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 (binary numeric) -.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 (Binary coded decimal numeric) -.0123456789 (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 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 (20H) 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 97 Full 32 bit version for Win 95/NT

Level 7 Tables

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

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

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

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. level and language of a table
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. [1]
  10. Lua error in package.lua at line 80: module 'strict' not found.

Further reading

  • Lua error in package.lua at line 80: module 'strict' not found.
  • Lua error in package.lua at line 80: module 'strict' not found.

External links