Get started Bring yourself up to speed with our introductory content.

Using REUSEDLT on physical files

Should I always use REUSEDLT (re-use deleted records) on my physical files?

When a record is deleted, it still holds up space. It is flagged as deleted. The default for a physical file is to leave such records in place and not to use their space when writing new records. This may lead to files full of deleted records and wasted space on the system. The solution then is to reorganize the files. This will release space.

But reorganizing a very large file or a file that is constantly in use is near to impossible. This is where the possibility to make the file re-use space left by deleted records comes handy. There are a few circumstances where re-use delete is not suitable. If you have a file in which record order matters, you can not use re-use delete, as your records would be mixed up. If you have keys, either physical or logical, that use FIFO, LIFO and so on, you will not be able to change your file to re-use deleted records. But I do not think that such file uses should be found in a modern database.

In the first case, you may use a sequence field or a time-stamp field that will be used in an access path to make sure you read your records in order. In the second case, you may add a time-stamp field that will record the time the record was created (for FIFO and LIFO) or the time the record was modified (for FCFO). You would simply modify your access path by adding the time stamp in the last key position, and you would be able to use re-use deleted records.

Dig Deeper on iSeries SQL commands and statements