DBFs wanted

This forum is meant for anything you would like to share with other visitors
Post Reply
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

DBFs wanted

Post by Karl-Heinz »

Guys,

I'm interested in the content of various DBF headers. Can someone give me a xBase++, Harbour and Visual Foxpro created dbf ? A single field - e.g. N, 5, 0 - without any content is enough.
,
TIA
Karl-Heinz
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

DBFs wanted

Post by wriedmann »

Hi Karl-Heinz,

IMHO FoxPro has different headers, and they depend on the version.
And they have different fieldtypes that the Clipper/VO world does not recognize.

I don't have samples anymore, but to read VFP databases I could not use the DBFCDX RDD, but had to use a self written binary reader.
I have attached this code here (really old - I have dismissed it inthe year 2005)
FoxProDBF-Code.zip
(2.72 KiB) Downloaded 28 times
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

DBFs wanted

Post by Karl-Heinz »

Thanks Wolfgang,

to be more specific: i´m interested in the second byte of the headers, the place where the year of the last update is stored. In your code from 2005 you read the date:

ConDate( Asc( SubStr3( cBuffer, 2, 1 ) ), Asc( SubStr3( cBuffer, 3, 1 ) ), Asc( SubStr3( cBuffer, 4, 1 ) ) )

so i guess the second byte content of the VFP DBF was at this time 0x05.

regards
Karl-Heinz
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

DBFs wanted

Post by wriedmann »

Hi Karl-Heinz,

AFAIK none of the DBF engines broke the DBF format of using only a 3 byte date.

Please see here: https://en.wikipedia.org/wiki/.dbf

My code was wrong here, I think.
DBase specifies this: https://www.dbase.com/Knowledgebase/INT ... le_fmt.htm

So I had to add 1900 to the year value (what I didn't made).

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

DBFs wanted

Post by Karl-Heinz »

Hi Wolfgang,

If you use SetEpoch() there´s no reason to add manually 100. My assumption was of course, that you have set SetEpoch () correctly before you executed the code.

I know this site ...

This here gives a much better explanation:
https://harbour.github.io/the-oasis/clipy2k.htm
[The .DBF header problem.] and the link to Greg Holmes


give it try with VO:

setcentury ( true )

setEpoch ( 1710 ) // yes, 1710 :-)
? condate ( 18 , 12 , 4 ) // 04.12.1718

setEpoch ( 1918 )
? condate ( 18 , 12 , 4 ) // 04.12.1918

setEpoch ( 1918 + 1 )
? condate ( 18 , 12 , 4 ) // 04.12.2018

The reason why i´ve started this thread: I only want to know/see how Harbour, xBase++ or VFP store e.g. the current year ( 2018 ) in the second byte. Is it 18 ( 0x12 ) as VO and even foxpro 2.0 does, or not.

BTW. VOs default SetEpoch() setting is 1910 ... time to move it ;-)

regards
Karl-Heinz
NEE4NEE
Posts: 4
Joined: Fri Dec 18, 2015 9:02 am

DBFs wanted

Post by NEE4NEE »

Attachments
TEST.zip
(206 Bytes) Downloaded 29 times
Karl-Heinz
Posts: 774
Joined: Wed May 17, 2017 8:50 am

DBFs wanted

Post by Karl-Heinz »

Many thanks !

as expected, the value of the second byte is "0x12"

regards
Karl-Heinz
Post Reply