DBF files are flat, simple database files that use defined record sizes, and field sizes. We need a utility program to optimize the size of the database by scanning though each field of the dbf and re-outputting the data in the smallest sized field possible to conserve space.
The utility should be able to handle strings, float, double, integer, and long values. floating, strings and integers have different optimizations. For strings you want to look for the longest string and then output a field size of the longest string. for integers you want to look for largest integer, and smallest if negatives are used. if for example, 100 is the max number and 0 is the minimum, you do not want to store it in a field size of 8 bytes, 1 byte would be sufficient!
also, if a double or a float is used and no decimal numbers are used at all in the data, then it should be converted into an integer of smallest size needed.
you would need to keep the following info on each field:
max number (ie 540), min number (ie -600), number with largest decimal (ie. 0.1234), or if it is a string max trimmed length of string.
then output the same dbf file only with adjusted field sizes to use least needed space.
if the max value for a particular field is 94.36 then you'd use field length 2 with decimal precision of 2...you get the picture...
and one more thing... watch out for minuses and nulls...
i have sample dbf files that can be used to test the optimization.
you should also output stats for each field in a text file of same name as the dbf file with txt extension, or something similar.
there is also a document describing dbf file format in detail...
i have it and it's also on the internet.
one more thing... we use dbf files with more than 1024 fields so don't rely on that limit as max!
we will need source code to this utility.
13 freelancers are bidding on average $460 for this job
Oh, man, that's simple. Indeed there's a nice logic behind the scenes, but it is simple. Specially for a CA/Clipper programmer like me (my everyday job since 2001). I have it all in mind. Best regards.