Ask the Expert

Reducing the file size

Reducing the file size

I've changed a field in a file to be variable length. As most of the records have blanks in this field, I've set the minimum length to zero. I've recreated the file and copied the data back into it. I then updated the file using %TRIMR to trim the trailing blanks from the variable length field. I am expecting an 80% reduction in the file size, but it hasn't changed? I've used %LEN to check the internal length of the field and the trailing spaces have been removed. Why hasn't the file size reduced? I've even re-organized the file but with no effect. How do I get the object to release the unused storage? What am I doing wrong?

I know that I can write a conversion program to read in the old file, populate the new file, and get the desired outcome. But I was hoping my initial approach would work.


Before you trim out the trailing blanks, your variable length fields are stored in a secondary storage container that's part of your file object. Even though you update these variable length fields to a length of zero, all/some of this storage space in the secondary container is left for new variable length field values that will be added in future inserts, updates, and deletes. In addition, the usage of variable length fields add some additional overhead to each record to keep track of the location and length of variable length fields. Also, if your variable length field is 30 bytes or less, than DB2 may also ignore your Allocate setting.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: tips, tutorials and more.

Check out this Search400.com Featured Topic: Database issues resolved


This was first published in October 2003

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: