xsharp.eu • DBFs wanted
Page 1 of 1

DBFs wanted

Posted: Tue Dec 04, 2018 11:06 am
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

DBFs wanted

Posted: Tue Dec 04, 2018 11:15 am
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 52 times
Wolfgang

DBFs wanted

Posted: Tue Dec 04, 2018 12:11 pm
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

DBFs wanted

Posted: Tue Dec 04, 2018 12:19 pm
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

DBFs wanted

Posted: Tue Dec 04, 2018 2:02 pm
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

DBFs wanted

Posted: Wed Dec 05, 2018 8:55 am
by NEE4NEE

DBFs wanted

Posted: Wed Dec 05, 2018 11:37 am
by Karl-Heinz
Many thanks !

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

regards
Karl-Heinz