PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Reorganize large physical files to get rid of deleted records

View previous topic View next topic Go down

Reorganize large physical files to get rid of deleted records

Post  maran on Sun Aug 12, 2012 9:28 pm

Reorganize large physical files to get rid of deleted records.

To check if a file has a lot of deleted record space, you can run the Display File Description (DSPFD) command, as follows:

DSPFD FILE(LIBRARY/FILE)


The bottom of this display shows the deleted record counts for each file member. If you see a large number of deleted records, you can eliminate the deleted records and compress the file by running a Reorganize Physical File Member (RGZPFM) command on the file, as follows:

RGZPFM FILE(LIBRARYNAME/FILENAME) KEYFILE(*NONE)


Running RGZPFM with the Key File (KEYFILE) parameter equal to *NONE removes the deleted records and compresses the active records in the file, so that all records are still stored according to their arrival sequence.

If you want to use RGZPFM to resequence your file according to the keyed sequence of the physical file's access path, you can run the RGZPFM command with *FILE in the KEYFILE parameter:

RGZPFM FILE(LIBRARYNAME/FILENAME) KEYFILE(*FILE)


When run this way, the arrival sequence of the reorganized records will be changed to match the keyed sequence access path of the file. Reorganizing by key can also speed up file access, because it makes it easier to retrieve records by their keys. You can also reorganize the file according to a logical file member key sequence by entering the logical file name, library name, and file member name of an associated logical file in the KEYFILE parameter.

Be aware that when you reorganize according to a file key, it eliminates your ability to read the file in its original arrival sequence. Another downside is that, by default, RGZPFM will only reorganize the first member in a physical file. If you want to reorganize other members of the file, run RGZPFM with a member name in the Member name (MEMBER) parameter. You should also note that RGZPFM locks the file being reorganized during the entire time that RGZPFM is running, so no one else can be using the file during that time.
avatar
maran
Admin

Posts : 442
Join date : 2009-07-24

View user profile http://pmsinformationsystem.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum