Page 1 of 1

Is a Dat File Empty

Posted: Fri Aug 07, 2009 2:58 pm
by ConvertFromOldNGs
by Torrie Moore >> Mon, 17 Dec 2007 4:14:59 GMT

Hi

Does anyone have a way of determining whether a dat file is empty? We have a system for which has had the PersistenDB.OpenAllFilesOnDbOpen flag set to true and I'd like to remove the empty dat files. I can tell their size and free space but can't easily see a way to determine whether they are empty of data or not.

Thanks

Torrie Moore

Re: Is a Dat File Empty

Posted: Fri Aug 07, 2009 2:58 pm
by ConvertFromOldNGs
by cnwjhp1 >> Mon, 17 Dec 2007 4:30:56 GMT

Wouldn't a jdbutil compact or a certify give you a list of objects?

Re: Is a Dat File Empty

Posted: Fri Aug 07, 2009 2:58 pm
by ConvertFromOldNGs
by Alan >> Mon, 17 Dec 2007 8:06:02 GMT

the attached script will produce a list, however, be aware that if the map file does not exist this script will create it

Re: Is a Dat File Empty

Posted: Fri Aug 07, 2009 2:58 pm
by ConvertFromOldNGs
by Torrie Moore >> Tue, 18 Dec 2007 1:44:40 GMT

Thanks for the script Alan.

I compared the script with the output from compressing the files and there were some dat files that the script reported as not being empty that were. I discovered it is due to the Class::instancesExist method returning true if the there are instances of a class or its subclasses. Changing it to check to

class.firstInstance <> null

Gave the right result.

Torrie