DBF - convert from old clipper ( DBT ) to FPT / CDX
Posted: Mon Mar 16, 2015 7:20 pm
Hello,
I have to convert a old Clipper app
There is a old DBF-format ntx and dbt
as well the text is saved loaded using AnsitoOem / OemtoAnsi
After my fist tests creating a temp.dbf from a structure-array
and append from the old data, I get a error :
Time from start: 0 hours 0 mins 9 secs
Error occurred at: 16.03.2015, 20:01:43
Error description: Error DBFCDX/1012 Corruption detected
Next I have to recover the missing < ÄÖÜäöü >
it means scanning all fields and replacing the missing chars.
Text is saved like :
I_VAR[48] := OemToAnsi((10)->WAEHRG1)
Import / convert a old DBF
Fields
...
...
AADD(DBFARRAY, { "RECHNG_ART", "N", 1, 0 })
AADD(DBFARRAY, { "LFD_RECHNR", "N", 5, 0 })
creating a Temp-file
IF LEN(DBFARRAY) == 0
MsgInfo( "DBF Structure-Error", "New Structure" )
RETURN NIL
ENDIF
DELETE FILE ( c_Pfad3 + "TEMP.DBF" )
DBCREATE( c_Pfad3 + "TEMP.DBF", DBFARRAY, "DBFCDX", .T. )
USE ( c_Pfad3 + "TEMP.DBF" ) // FPT created
Append the old DBF
IF File( c_Pfad3 + "OLD.DBF" )
APPEND FROM ( c_Pfad3 + "OLD.DBF" )
DELETE FILE ( c_Pfad3 + "OLD.DBF" )
FRENAME( c_Pfad3 + "TEMP.DBF", c_Pfad3 + "NEW.DBF" )
FRENAME( c_Pfad3 + "TEMP.FPT", c_Pfad3 + "NEW.FPT" )
ENDIF
Maybe any existing solutions ?
best regards
Uwe
I have to convert a old Clipper app
There is a old DBF-format ntx and dbt
as well the text is saved loaded using AnsitoOem / OemtoAnsi
After my fist tests creating a temp.dbf from a structure-array
and append from the old data, I get a error :
Time from start: 0 hours 0 mins 9 secs
Error occurred at: 16.03.2015, 20:01:43
Error description: Error DBFCDX/1012 Corruption detected
Next I have to recover the missing < ÄÖÜäöü >
it means scanning all fields and replacing the missing chars.
Text is saved like :
I_VAR[48] := OemToAnsi((10)->WAEHRG1)
Import / convert a old DBF
Fields
...
...
AADD(DBFARRAY, { "RECHNG_ART", "N", 1, 0 })
AADD(DBFARRAY, { "LFD_RECHNR", "N", 5, 0 })
creating a Temp-file
IF LEN(DBFARRAY) == 0
MsgInfo( "DBF Structure-Error", "New Structure" )
RETURN NIL
ENDIF
DELETE FILE ( c_Pfad3 + "TEMP.DBF" )
DBCREATE( c_Pfad3 + "TEMP.DBF", DBFARRAY, "DBFCDX", .T. )
USE ( c_Pfad3 + "TEMP.DBF" ) // FPT created
Append the old DBF
IF File( c_Pfad3 + "OLD.DBF" )
APPEND FROM ( c_Pfad3 + "OLD.DBF" )
DELETE FILE ( c_Pfad3 + "OLD.DBF" )
FRENAME( c_Pfad3 + "TEMP.DBF", c_Pfad3 + "NEW.DBF" )
FRENAME( c_Pfad3 + "TEMP.FPT", c_Pfad3 + "NEW.FPT" )
ENDIF
Maybe any existing solutions ?
best regards
Uwe