• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Admin Alert: Reorganizing IBM i Files To Improve Disk Performance, Part 2

    June 25, 2014 Joe Hertvik

    Last issue, I began putting together a template for detecting and efficiently reorganizing physical files on IBM i partitions. I covered the most common reasons administrators reorganize files and demonstrated a procedure for detecting which files on your system need reorganization. This week, I’ll complete the process by reviewing different ways to reorganize files and look at some techniques for file reorganization while the file is active.

    Steps To Effectively Reorganizing Files

    As I discussed last time, here are the steps to follow for an effective disk reorganization strategy.

    1. Set up a procedure for identifying files and members that need reorganization.
    2. Properly setting up your Reorganize Physical File Member (RGZPFM) statements.
    3. Identifying times that critical files can be reorganized.
    4. Rinse and repeat.

    Last issue, I covered step #1. This time, I’ll discuss steps 2 through 4.

    Step 2: Properly setting up your Reorganize Physical File Member (RGZPFM) statements

    There are a number of techniques for effectively running physical file reorganizations. In the IBM i operating system, file reorgs can be accomplished by running any one of the following Reorganize Physical File Member command versions:

    • RGZPFM FILE(library/filename) /* version 1 */
    • RGZPFM FILE(library/filename) ALWCANCEL(*YES) /* version 2 */
    • RGZPFM FILE(library/filename) RBDACCPTH(*OPTIMIZE) ALWCANCEL(*YES) /*version 3*/

    Here’s how each of these file reorganizations work and the benefits each technique provides.

    Version 1 RGZPFM–Just the basics

    The version 1 command is a standard RGZPFM command that just removes deleted records and reorganizes the file. It is the most common way of running RGZPFM. Version 1 is easy to run and seldom causes any problems.

    The downside is that with a version 1 reorg, you’ll lose any in-process reorganization work if you cancel a file reorganization before it completes. If you cancel a version 1 RGZPFM command from either the green screen or inside a batch job, any reorg changes that were made to the target file will be discarded and the file will contain the same number of deleted records it had when it started.

    Version 2 RGZPFM–Cancelling a reorg without penalties

    The version 2 RGZPFM command allows you to cancel the reorg as needed, either on the green screen or inside a batch job. Because its Allow Cancel (ALWCANCEL) parameter is set to *YES, cancelling a version 2 RGZPFM command will retain all the file reorganization changes that have been completed so far and your file will be partially reorganized. The next time you start the RGZPFM command on a partially reorganized file, the operating system will attempt to restart the reorganization at the point it was cancelled. If too many changes occur after a cancelled reorganization, the operating system may opt to restart the reorganization at the beginning of the file rather than attempting to continue from the last reorganization attempt.

    Version 3 RGZPFM–Getting a jump start on rebuilding associated logical file access paths

    The version 3 RGZPFM command adds some flexibility when related file logical file access paths are rebuilt as their associated physical file is reorganized. It does this through the Rebuild Access Paths (RBDACCPTH) parameter.

    Related logical file reorganizations are controlled through the access path rebuild list that’s maintained and controlled through the Edit Rebuild of Access Paths (EDTRBDAP) command. This can add some time to your access path rebuilds as, by default, there are only a set number of logical files that can have their access paths rebuilt by the system at the same time when using the EDTRBDAP list. All of which adds time to your reorganization, depending on how many logical files are waiting in line to be reorganized via EDTRBDAP.

    In our RGZPFM command versions 1 and 2, RBDACCPTH is set to *YES (its default setting). Setting RBDACCPTH to *YES designates that all dependent logical file access paths are synchronously reorganized after the RGZPFM command finishes (no logical file reorganization happens until the physical is reorged).

    There are two ways you can speed up IBM i access path rebuilds: manually or by setting the RGZPFM’s RBDACCPTH to *OPTIMIZE, which is demonstrated in the version 3 RGZPFM statement.

    You can manually increase the number of simultaneous access path rebuilds by using a technique I outlined in an earlier article. This technique requires you to monitor and change the EDTRBDAP list, and to submit batch jobs to speed up multiple logical file rebuilds.

    The second way to increase the number of simultaneous access path rebuilds is to set the Rebuild Access Path (RBDACCPTH) parameter on your RGZPFM command to *OPTIMIZE. As shown in my RGZPFM version 3 command, setting RBDACCPTH to *OPTIMIZE gives the operating system some leeway on how to rebuild associated access paths. When using *OPTIMIZE, the IBM i operating system will rebuild access paths for a reorganized file in one of the following ways: Associated access paths will be rebuilt asynchronously when the reorganization operation on the physical file ends; or associated access paths will be maintained and rebuilt during the reorganization.

    The operating system decides how to rebuild access paths, based on which method it calculates will finish the access path rebuilds faster (optimizing the rebuilds).

    There are other parameters you can set for your RGZPFM commands, but these are the basic ones that affect the file’s ability to recover from a cancelled reorg and to speed up access path rebuilds after your reorganization.

    Step 3: Identifying times that critical files can be reorganized

    The next step determines when you want to or are able to reorganize system files with excessive deleted records.

    Because a RGZPFM operation requires file locks, you’ll usually have to arrange for your file reorganizations to occur when the files aren’t in use or configure your reorganizations to occur while the file is active.

    Reorganizing files to account for record locking can be accomplished in the following ways:

    1. By quieting your IBM i system so that any applications that usually lock your reorged files are not running. This would involve running your reorganizations during a maintenance window when application files are not in use and the system is quiet for rebuilds.

    2. By specifying whether the RGZPFM command should exclusively lock the file that it’s reorganizing or whether the target file should be shared for reading or updating (reorg-while-active). This is done through the Lock state parameter on your RGZPFM command (LOCK). LOCK can be set to any one of three different setting as shown by these RGZPFM command examples

    • RGZPFM FILE(library/filename) LOCK(*EXCL) /* version 4 */
    • RGZPFM FILE(library/filename) LOCK(*EXCLRD) ALWCANCEL(*YES) /* version 5 */
    • RGZPFM FILE(library/filename) LOCK(*SHRUPD) ALWCANCEL(*YES) /*version 6*/

    In the version 4 RGZPFM command, the LOCK parameter is set to its default setting of Exclusive (*EXCL). In this iteration, the RGZPFM command must be able to get an exclusive lock on the file it is reorganizing and no other process can access the file while it is being reorganized. The file must be in a quiet state (no other users) in order to use the version 4 RGZPFM command.

    The LOCK Exclusive Read (*EXCLRD) parameter in the version 5 RGZPFM command allows other users to read but not write, update, or delete records in the file being reorganized. In order to use *EXCLRD for your LOCK parameter, you also need to set the Allow Cancel parameter to *YES.

    For the version 6 RGZPFM command, LOCK is set to Shared Updated (*SHRUPD) which allows users to read, write, update, and delete individual records in the file as it is being reorganized. Like the version 5 RGZPFM command, you also need to set the Allow Cancel parameter to *YES. It’s important to note that if you’re reorganizing the file in key file sequence or need to maintain the records in arrival sequence, you shouldn’t use the LOCK = *SHRUPD parameter with this command.

    When you set the LOCK parameter to either *EXCLRD or *SHRUPD, you are performing a reorg-while-active function, which allows the file to be accessed while the reorganization is occurring.

    Step 4: Rinse and repeat

    After you’ve performed the other three steps, the final step is to run your file reorganizations on a regular basis.

    This means setting up scheduled jobs that will run all your required reorganization commands on a regular basis. As I mentioned last issue, file reorganizations are a temporary disk recovery technique. You’ll be able to reduce disk space by running all your designated reorganizations at one time. But after you reorganize, the number of deleted records will slowly start to climb again, and you’ll have to run your target reorgs on a regular basis to enjoy the full benefits of your file reorganization strategy.

    Putting together a file reorganization strategy like this isn’t a one-time event. But once the strategy is conceived and implemented, it can produce a number of benefits in reducing the amount of used disk space and improving production efficiency.

    Joe Hertvik is an IBM i subject matter expert (SME) and the owner of Hertvik Business Services, a content strategy company that provides white papers, case studies, blogging, and social media services for B2B software companies. Joe also runs a data center and help desk for several companies. Joe has written the Admin Alert column for IT Jungle since 2002.

    RELATED STORIES

    Reorganizing IBM i Files to Improve Disk Performance, Part 1

    Speeding Up i5/OS Access Path Rebuilds



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Midrange Dynamics North America

    Git up to speed with MDChange!

    Git can be lightning-fast when dealing with just a few hundred items in a repository. But when dealing with tens of thousands of items, transaction wait times can take minutes.

    MDChange offers an elegant solution that enables you to work efficiently any size Git repository while making your Git experience seamless and highly responsive.

    Learn more.

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    CloudFax400:  Moving to an IBM PureSystems™? You need our cloud-based enterprise FAX service.
    System i Developer:  Upgrade your skills at the RPG & DB2 Summit in Minneapolis, Sept 30 - Oct 2.
    COMMON:  Join us at the COMMON 2014 Fall Conference & Expo in Indianapolis, Oct 27-29

    More IT Jungle Resources:

    System i PTF Guide: Weekly PTF Updates
    IBM i Events Calendar: National Conferences, Local Events, and Webinars
    Breaking News: News Hot Off The Press
    TPM @ EnterpriseTech: High Performance Computing Industry News From ITJ EIC Timothy Prickett Morgan

    Quadrant and BCD Re-Align Partner Programs DB2 for i 7.2 Features and Fun, Part 1

    Leave a Reply Cancel reply

Volume 14, Number 14 -- June 25, 2014
THIS ISSUE SPONSORED BY:

SEQUEL Software
WorksRight Software
Bug Busters Software Engineering

Table of Contents

  • DB2 for i 7.2 Features and Fun, Part 1
  • Here’s More Help For A Huge Hardship
  • Admin Alert: Reorganizing IBM i Files To Improve Disk Performance, Part 2

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Public Preview For Watson Code Assistant for i Available Soon
  • COMMON Youth Movement Continues at POWERUp 2025
  • IBM Preserves Memory Investments Across Power10 And Power11
  • Eradani Uses AI For New EDI And API Service
  • Picking Apart IBM’s $150 Billion In US Manufacturing And R&D
  • FAX/400 And CICS For i Are Dead. What Will IBM Kill Next?
  • Fresche Overhauls X-Analysis With Web UI, AI Smarts
  • Is It Time To Add The Rust Programming Language To IBM i?
  • Is IBM Going To Raise Prices On Power10 Expert Care?
  • IBM i PTF Guide, Volume 27, Number 20

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle