TWKDBF – Tweak Database File

Projex4i - The IBM i Software Developers Toolkit

The TWKDBF command is used to Tweak Database Files. *DUH*   In sensible English, this means you can easily modify, or tweak, the access path attributes of all Logical files over a specified Physical file.

This is particularly useful when performing a full data rebuild of a physical file with many logical files: If all access paths are left at *IMMED, the IBM i System will automatically spend time updating the logical file access paths for EVERY RECORD written to the file. If you are reloading a large file this can be a noticeable overhead.

The command can be used to switch all Logical files to *REBLD before the data is loaded, and switched back to *IMMED (or *DLY) after completion. Note, when the file is returned to *IMMED after reloading all the data. The System  will then recreate the logical file access paths – saving a lot of unnecessary machine work.

It can also easily change the REUSEDLT parameter to set whether you want to re-use the storage space taken up by deleted records or leave them deleted – not reused – so have to opportunity to retrieve those deleted records in the future (have a look at the RTVDLTRCD command)

If you have lots of deleted records then the REORG parameter lets you easily reorganize the file in quick time:

The Reorganize Physical File Member (RGZPFM) command removes deleted records from (compresses) one member of a physical file in the database, and it optionally reorganizes that member.