Page 1 of 2

DBZAP() Corrupted

Posted: Mon Apr 02, 2012 5:36 am
by dougtanner
I am intermittently getting a "Internal data structures corrupted" (IDSC) on a THEDBF->(DBZAP()) command. The .dbf is a temporary file created by the program with a .NTX and use exclusively. The code will execute the DBZAP several times before it throws and IDSC error. It happens on different .dbfs and different locations in the program.

Doug

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 6:12 am
by Tom
Hi, Doug.

DbZap() is not corrupted. If you face an IDSC on DbZap(), you may have forgotten to check if the table really was opened exclusively. Just put an IF NetErr() behind the USE/DbUseArea(). It also may be an Antivirus program interfering with your app. Exclude your program and data path from the Antivirus software.

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 6:30 am
by dougtanner
Thanks Tom,
These are temporary files I know are only opened exclusively. The DBZAP() executed without error several times before on these files before the IDSC error. I will check into the Virus Protection as a possible culprit!
Doug

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 7:13 am
by Auge_Ohr
hi,

are these Files "local" or on "Server" ?
what OS() ?

have DBF used before ZAP ?

greetings by OHR
Jimmy

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 7:19 am
by rdonnay
I have heard of this problem over the years and I believe that one solution is to close and reopen the file after getting zapped.

In one app I just wrote a wrapper for dbZap().

Code: Select all

FUNCTION My_dbZap()

LOCAL cAlias, cDBF, cIndex

cDBF := DC_TableName()
cIndex := DC_IndexName()
cAlias := Alias()
dbZap()
dbCloseArea()
USE (cDBF) EXCLUSIVE VIA (cAlias)
IF !Empty(cIndex)
  SET INDEX TO (cIndex)
ENDIF

RETURN nil

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 7:50 am
by dougtanner
Jimmy,

I tried putting the files on both places, Local hard drive and on the Windows server. Same intermittent error. The OS was Windows XP. The files had been in exclusive use and Zap'ed several times before the error.

Rodger,

I like your solution and had already figured out that closing and recreating was the solution. I'll give your function a try.

Thanks to all,

Doug

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 8:40 am
by dougtanner
Roger,

I changed:

USE (cDBF) EXCLUSIVE VIA (cAlias)

TO:

USE (cDBF) EXCLUSIVE ALIAS (cAlias)

Which worked, You were just testing me weren't you?

After second thoughts, to be safe, I changed it to
IF ".CDX" $ cIndex
USE (cDBF) EXCLUSIVE ALIAS (cAlias) VIA "DBFCDX"
ELSE
USE (cDBF) EXCLUSIVE ALIAS (cAlias) VIA "DBFNTX"
ENDIF

Thanks,
Doug

Re: DBZAP() Corrupted

Posted: Mon Apr 02, 2012 10:50 am
by dougtanner
Roger,

The close and reopen function stopped the stopped the IDSC errors for DBZAP()

Thanks,
Doug

Re: DBZAP() Corrupted

Posted: Tue Apr 03, 2012 6:37 am
by dougtanner
I was premature in thinking the problem was fixed. It went from happening frequently to happening every now and then. It looks like I will rewrite the code to eliminate the Zaps!

Doug

Re: DBZAP() Corrupted

Posted: Tue Apr 03, 2012 8:13 am
by Tom
Doug -

I was wrong with "DbZap() is not corrupted". I just checked the error reports my support received during 2007 to 2010. There were lots of IDSCs in there assigned to DbZap(). But I removed all this - I a) stopped using temporary files wherever possible and replaced them using arrays (much faster anyway) and I b) created temp files from scratch where desperately needed. There is not a single DbZap() in my code anymore.