Page 1 of 1

DBF-Header-Information ( NTX or CDX ) with DBINFO ?

Posted: Wed Jan 23, 2008 4:01 pm
by ukoenig
Hello, from Germany

I'm looking for the RDD-Header-Information of a DBF,
how the database has been created ( NTX / CDX )
I need it, because i must know,
if the DBF is converted from NTX to CDX.
Without Index and Memo, there is no way to find out.
The Information must be somewhere in the file-header.

I checked the DBINFO - Function with all parameters,
but couldn't find a Parameter, for any informations
what RDD has been used during the creation of the DBF.
When the DBF has a MEMO, i can ask for the MEMO-Type ( FPT ).
But what to do, when there is no memo and no index ?

The Parameter DBI_RDD_VERSION returns the
same for NTX and CDX => a Version No., but of what ?

Somebody knows what to do ?

Regards
U. König

Posted: Thu Jan 24, 2008 8:24 am
by StefanHaupt
Uwe,

read the information direct from the dbf with the low level functions fopen(), fread()

Posted: Thu Jan 24, 2008 10:08 am
by Antonio Linares
U. König,

What you want to know is if it uses NTX or CDX ?

Re: DBF-Header-Information ( NTX or CDX ) with DBINFO ?

Posted: Thu Jan 24, 2008 10:28 am
by Manuel Valdenebro
ukoenig wrote:Somebody knows what to do ?

FUNCTION CabDbf (cNom)
LOCAL nHnd, cBytes, nCdx, cCdx
cNom := cNom + '.dbf'

// öffnen wir die Datei exclusiv (binary)
// Abrimos el fichero en exclusiva (binario)
IF (nHnd := FOpen( cNom, 18 )) > 0

// gehe wir zu byte 28
// vamos al byte 28
FSeek( nHnd, 28 )

// beginnen wir die Variable
// iniciamos la variable
cBytes := '0'

// esen wir die Hauptpunkte der byte 28
// leemos en la cabecera el byte 28
FRead(nHnd, @cBytes, 1)
nCdx := Bin2I(cBytes)
IF nCdx = 1
cCdx := "Table CDX"
ELSE
cCdx := "NICHT CDX"
ENDI

MSGINFO ( cCdx )

FClose(nHnd)
ENDIF

RETURN nil

Entschuldigen sie bitte mein deutsch

Tschüss

Posted: Thu Jan 24, 2008 11:56 am
by ukoenig
Dear Mr. Valdenebro

Thank you very much for the function.
It works great.
It is exactly, what i need.
As a sample :
When i work with NTX and CDX together
and use a wrong RDD. i had some problems
because =>
DEFAULT = "NTX. I open a CDX-DBF
i cannot look for the ???.CDX .and. ???.FPT
the CDX - name is not the same like the DBF with no MEMO,
there was no chance to look for the type.

Regards

Uwe König