Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determining the .dbf file version 1

Status
Not open for further replies.

holdemfoldem

Programmer
Jun 5, 2001
8
0
0
US
I am working with some .dbf files and my supervisor wants to know what version they are. Presumably they're dBase IV, but is there some sort of utility I can run which will open the files and determine what version of dBase they represent?
Thanks ahead for help!
 
Well, I know that by view the first byte of the file header will yield the versions for dBase II and dBase III so presumably the same will hold true for dBase IV.

The first byte of the file header for dBase II is 02h, dBase III is 03h, so if the above is true, then dBase IV should be 04h.

There's always a better way...
 
Thanks for the reply, Tviman. I have opened several .dbf files in VB and displayed the asci representation of the first 4 bytes of the files. I've had varied results as follows:

139 - 100 - 4 - 6
3 - 100 - 3 - 19
3 - 100 - 4 - 25
139 - 100 - 1 - 31

When you refer to the first byte of the header, do you mean the first byte of the whole file, or is there some sort of a "beginning of header" byte sequence?

Thanks again for help.
 
dBase III, IV, V tables all have a 3 (or 03 hex) as the first character in the header. If the table has one or more memo fields, meaning there is an associated .DBT file, then the first character is 139 (or 8B hex).

Here is a FAQ from the FoxPro 3+ forum that describes table headers, and the program should even work if you modify it a bit for dBase, such as replacing ALLTRIM() with LTRIM(RTRIM()):
faq184-3162

List showing decimal equivalents:

2 Foxbase
3 Foxbase/Foxpro/dBaseIII/IV/V no memo
48 Visual Foxpro
67 dBase IV SQL table no memo
99 dBase IV SQL system file no memo
131 Foxbase/dBaseIII Plus with memo
139 dBaseIV/V with memo
203 dBaseIV SQL table with memo
245 Foxpro 2.x with memo
251 Foxbase


 
Thanks, dbMark! Based on what you listed, I am working with either dBase IV or V files.

Hopefully this should be sufficient for my supervisor. Just in case, though, is there a way to distinguish between dBase IV and dBase V files, once you've established you have one of the above?

Thanks for all responses!
 
So far as I know there were no table structure changes from dBase version 4 to 5 for DOS. Program enhancements and changes, yes, lots of new commands, etc. but all worked with the same table structures. But I'm fairly sure the table structures did not change.

When Microsoft came out with Visual FoxPro they added quite a few new field data types, database containers and possibly other things too. I don't know much about the more recent dBase products either.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top