DBZAP() Corrupted

This forum is for general support of Xbase++
Message
Author
dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

DBZAP() Corrupted

#1 Post 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

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DBZAP() Corrupted

#2 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

Re: DBZAP() Corrupted

#3 Post 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

User avatar
Auge_Ohr
Posts: 1407
Joined: Wed Feb 24, 2010 3:44 pm

Re: DBZAP() Corrupted

#4 Post by Auge_Ohr »

hi,

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

have DBF used before ZAP ?

greetings by OHR
Jimmy
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4729
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DBZAP() Corrupted

#5 Post 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
The eXpress train is coming - and it has more cars.

dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

Re: DBZAP() Corrupted

#6 Post 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

dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

Re: DBZAP() Corrupted

#7 Post 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

dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

Re: DBZAP() Corrupted

#8 Post by dougtanner »

Roger,

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

Thanks,
Doug

dougtanner
Posts: 32
Joined: Fri Jan 20, 2012 9:24 am

Re: DBZAP() Corrupted

#9 Post 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

User avatar
Tom
Posts: 1171
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: DBZAP() Corrupted

#10 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Post Reply