I got runtime error message DBFNTX/1210 Corruption Deteced prompt out when my customer run the program. The program has been use for 1 years+ and now I'm checking on it and wonder the cause of the problem. I have delete index file and reindex again but still donot help.
Below are the source code and the line that marked with ***** is where the error occurred:-
FUNCTION Update_BAR( cDataPath, cSourceFile, cTargetFile, cNtx1, cNtx2, dStrDate )
LOCAL aStruct := {}
LOCAL cBarCode := ""
Local cSKN := ""
Local cMsg := "Updating HQBAR in progress."
LOCAL cImportFile := cSourceFile + "."
LOCAL nRecNo := 0
Local nTotRecs := 0
MsgRun( cMsg, "Updating Database" )
If File( cImportFile )
cTargetFile := cDataPath + "\" + cTargetFile
cNtx1 := cDataPath + "\" + cNtx1
cNtx2 := cDataPath + "\" + cNtx2
AADD( aStruct, { "Indicator", "C", 1, 0 } )
AADD( aStruct, { "Barcode", "C", 20, 0 } )
AADD( aStruct, { "Skn", "C", 15, 0 } )
DBCREATE( cSourceFile, aStruct )
NetUse( cSourceFile, .T., 5, "Source" )
APPEND FROM ( cImportFile ) SDF
NetUse( cTargetFile, .T., 5, "Target" )
Set Index to ( cNtx2 ), ( cNtx1 )
nTotRecs := Target->( LastRec() )
SELECT Source
If Source->( LastRec() ) >= 1
GO TOP
DO WHILE Source->( !EOF() )
nRecNo := Source->( RECNO() )
cSKN := Source->Skn
SELECT Target
***** IF Target->( DBSEEK( cSKN ) )
If Source->Indicator # "D"
Source->Indicator := "C"
Endif
ELSE
If Source->Indicator # "D"
APPEND BLANK
Source->Indicator := "A"
Endif
ENDIF
SELECT Target
Target->Indicator := Source->Indicator
Target->SKN := Source->SKN
Target->Barcode := Source->Barcode
SELECT Source
GOTO nRecNo
Source->( DBSKIP() )
ENDDO
Endif
Source->( DBCLOSEAREA() )
SELECT Target
SaveLog( "Download - Updated " + AllTrim( Str( Target->( LastRec() )-nTotRecs ) ) + " records (HQBAR).", "AS/400", .T., dStrDate )
Target->( DBCLOSEAREA() )
Endif
RETURN NIL
Please advice on what should i do next.
Thanks a lot.
Below are the source code and the line that marked with ***** is where the error occurred:-
FUNCTION Update_BAR( cDataPath, cSourceFile, cTargetFile, cNtx1, cNtx2, dStrDate )
LOCAL aStruct := {}
LOCAL cBarCode := ""
Local cSKN := ""
Local cMsg := "Updating HQBAR in progress."
LOCAL cImportFile := cSourceFile + "."
LOCAL nRecNo := 0
Local nTotRecs := 0
MsgRun( cMsg, "Updating Database" )
If File( cImportFile )
cTargetFile := cDataPath + "\" + cTargetFile
cNtx1 := cDataPath + "\" + cNtx1
cNtx2 := cDataPath + "\" + cNtx2
AADD( aStruct, { "Indicator", "C", 1, 0 } )
AADD( aStruct, { "Barcode", "C", 20, 0 } )
AADD( aStruct, { "Skn", "C", 15, 0 } )
DBCREATE( cSourceFile, aStruct )
NetUse( cSourceFile, .T., 5, "Source" )
APPEND FROM ( cImportFile ) SDF
NetUse( cTargetFile, .T., 5, "Target" )
Set Index to ( cNtx2 ), ( cNtx1 )
nTotRecs := Target->( LastRec() )
SELECT Source
If Source->( LastRec() ) >= 1
GO TOP
DO WHILE Source->( !EOF() )
nRecNo := Source->( RECNO() )
cSKN := Source->Skn
SELECT Target
***** IF Target->( DBSEEK( cSKN ) )
If Source->Indicator # "D"
Source->Indicator := "C"
Endif
ELSE
If Source->Indicator # "D"
APPEND BLANK
Source->Indicator := "A"
Endif
ENDIF
SELECT Target
Target->Indicator := Source->Indicator
Target->SKN := Source->SKN
Target->Barcode := Source->Barcode
SELECT Source
GOTO nRecNo
Source->( DBSKIP() )
ENDDO
Endif
Source->( DBCLOSEAREA() )
SELECT Target
SaveLog( "Download - Updated " + AllTrim( Str( Target->( LastRec() )-nTotRecs ) ) + " records (HQBAR).", "AS/400", .T., dStrDate )
Target->( DBCLOSEAREA() )
Endif
RETURN NIL
Please advice on what should i do next.
Thanks a lot.