ZAP and PACK command for DBF files - error Win 11

This forum is for eXpress++ general support.
Message
Author
Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

ZAP and PACK command for DBF files - error Win 11

#1 Post by Victorio »

Hi,
it has nothing to do with eXpress++, rather Xbase++, but maybe somebody know about this.

one of my clients complained that the program crashes when creating a statement.
I found out that it happens when opening a DBF Visual Foxpro database and the command ZAP, or even PACK, the program completely crashes, shuts down. I temporarily replaced ZAP and PACK with DELETE ALL, and this is how it works. But both ZAP and PACK have been giving me problems for a long time, sometimes it crashes, sometimes it doesn't. Is there any alternative to ZAP and PACK? DBpack() causes problems as well.

At this moment I can eliminate this with disable ZAP and PACK in my source and use CREATE FROM ... to create new empty DBF file, effect is same, only more disc operations.

User avatar
SlavkoDam
Posts: 117
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: ZAP and PACK command for DBF files - error Win 11

#2 Post by SlavkoDam »

Hi,
PACK and ZAP work great in Xbase++. I use them a lot in my applications, without any problems on any Windows system. They have worked fine in the old Clipper too. :)
Does your program crashes happen only on VFP database or also on standard DBF database? Does it happen only on Win11 or on all Wins? As you say,they have been giving you problems for a long time.
Can you send a part of your program code for opening a database and doing PACK and/or ZAP? It would help to understand the problem.
You may devise some alternative for PACK and ZAP, but it is not necessary and has no sense.
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

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

Re: ZAP and PACK command for DBF files - error Win 11

#3 Post by Tom »

Best regards,
Tom

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

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ZAP and PACK command for DBF files - error Win 11

#4 Post by Victorio »

Hi SlavkoDam,

example :
* close DBF if is open
close TEMPVLA
SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE
zap // here crashes
pack // here also crashes
set default to &cestatemp
index on KN_CLV TAG CLV // doplnené 4.4.2017 aby bola zhoda ako pri bytoch
index on KN_CLV*10000+KN_PCS TAG CVL // indexovanie podľa CLV+PCS
set default to &cestahlprg
close TEMPVLA
SELECT 24
use &nazovdbf24 index &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE
go top


I have this problem long time, the program crashes most often on PACK but not always, sometimes it works without problems, sometimes if it crashes and repeatedly crashes again, restarting the PC will help.

Now I modify program with this :
close TEMPVLA
filedelete(nazovdbf24+".*")
SELECT 4
copy stru to &nazovdbf24
SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE



but when I do not want close DBF, can not realize this.

Database is DBF type :Code / Type : 48 Visual Foxpro
Struct Index File: No
Memo file ; No
File is a VFP DBC: No
Number of fields : 46.03
Codepage mark : 100 ( Codepage 852 Easern European MS-DOS )

Tom :
I can try this, maybe some index can be still open howevere dbf is closed ?
but this problem only occurs occasionally, I can't simulate it so that it always crashes.

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

Re: ZAP and PACK command for DBF files - error Win 11

#5 Post by Tom »

but this problem only occurs occasionally, I can't simulate it so that it always crashes.
Yes, it sometimes crashes, under certain circumstances. This is what the PDR says. The only chance is to try the workaround.
Best regards,
Tom

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

User avatar
SlavkoDam
Posts: 117
Joined: Wed Apr 27, 2022 10:12 am
Location: Negotin, Serbia
Contact:

Re: ZAP and PACK command for DBF files - error Win 11

#6 Post by SlavkoDam »

Hi,
In your example you do PACK/ZAP without indexes, so you don't have problem with indexes. But, I agree that its better to do PACK/ZAP without indexes and do reindexing afterwards.
I think the problem is in your use of SELECT and USE commands. What did you want to do with this:

SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE

What dbf is opened in a work area 24, and is it closed? The best and simplest way is not to use SELECT and to use USE with NEW option, and let the system to create a new work area. Also, its easier and more readable in a program to use SELECT cAlias then SELECT nWorkArea. So, I suggest to replace above with this:

use &nazovdbf24 ALIAS TEMPVLA NEW EXCLUSIVE

Also, in your modified code:

SELECT 4
copy stru to &nazovdbf24
SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE

what dbfs are opened in work areas 4 and 24?

Slavko
Best regards,

Slavoljub Damnjanovic
SD-SoftDesign, Alaska Software Technology Partner
https://www.sd-softdesign.com
https://www.sd-softdesign.rs

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ZAP and PACK command for DBF files - error Win 11

#7 Post by Victorio »

Savko,
SELECT 4 is a sample database from which I need to create a new empty dbf.
I have SELECT xx in all programs, because I use around 100 DBFs, and I always know what is in SELECT 4, and what is in select 99, and aliases sometimes do not have the same name for the same SELECT xx number (for example, when switching between DBFs from different archive dates)

k-insis
Posts: 125
Joined: Fri Jan 28, 2011 4:07 am

Re: ZAP and PACK command for DBF files - error Win 11

#8 Post by k-insis »

This is full Clipper code?

I remember some old releases of xpp having trouble with pack and zap commands
In case of ZAP I think we replaced it with routine that took structure, ferased file and recreated file with dbcreate.

AFAIR It used to be that fox and similiar driver opened associated index file (if same filename + .cdx) was in same directory. Zap / Pack failing is associated with opened indexes.

For PACK it would be something that is part of "topdown" library FUNCTION tdPack (there is full source available). It does pack with copying data to new file and later renaming it into original while original is left as backup.

Also you should really, really do error checking with NetErr() , Ferror() and error recovery based on return values.

Sometimes even system antivirus got suspicious on programs truncating files.


Victorio wrote: Mon Jun 17, 2024 12:50 am Hi SlavkoDam,

example :
* close DBF if is open
close TEMPVLA
SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE
zap // here crashes
pack // here also crashes
set default to &cestatemp
index on KN_CLV TAG CLV // doplnené 4.4.2017 aby bola zhoda ako pri bytoch
index on KN_CLV*10000+KN_PCS TAG CVL // indexovanie podľa CLV+PCS
set default to &cestahlprg
close TEMPVLA
SELECT 24
use &nazovdbf24 index &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE
go top


I have this problem long time, the program crashes most often on PACK but not always, sometimes it works without problems, sometimes if it crashes and repeatedly crashes again, restarting the PC will help.

Now I modify program with this :
close TEMPVLA
filedelete(nazovdbf24+".*")
SELECT 4
copy stru to &nazovdbf24
SELECT 24
use &nazovdbf24 ALIAS TEMPVLA EXCLUSIVE



but when I do not want close DBF, can not realize this.

Database is DBF type :Code / Type : 48 Visual Foxpro
Struct Index File: No
Memo file ; No
File is a VFP DBC: No
Number of fields : 46.03
Codepage mark : 100 ( Codepage 852 Easern European MS-DOS )

Tom :
I can try this, maybe some index can be still open howevere dbf is closed ?
but this problem only occurs occasionally, I can't simulate it so that it always crashes.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: ZAP and PACK command for DBF files - error Win 11

#9 Post by Victorio »

It is possible that it is caused by an older version of Xbase++, I have a release 554 of Xbase++ Foundation edition 2.0.
It is possible that this is caused by an older version of Xbase++, I have a release ,
I didn't buy a newer update because I only maintain my old programs and it's not worth it to me to invest almost 1000 Euros in a new version, even if Alaska released a 64bit version it would help me, but because of the RAM usage limitations of 2GB it wouldn't help me much.

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

Re: ZAP and PACK command for DBF files - error Win 11

#10 Post by Auge_Ohr »

hi Victorio,
Victorio wrote: Wed Jun 19, 2024 6:29 am I didn't buy a newer update because I only maintain my old programs and it's not worth it to me to invest almost 1000 Euros in a new version, even if Alaska released a 64bit version it would help me, but because of the RAM usage limitations of 2GB it wouldn't help me much.
the 2GB Limit is only the maximum Lock Offset in 32 Bit Environment
there are almost no Limit use 64 Bit Lock Offset for DBF using Harbour HB64

you can download free Version on HMG 64 bit here
https://www.hmgforum.com/app.php/downlo ... 72594ae3a2
greetings by OHR
Jimmy

Post Reply