Manage Learn to apply best practices and optimize your operations.

Reorganizing locked files

Reorganizing locked files

Is it possible to reorganize a file when the file is locked?
No. The RGZPFM process requires exclusive access to the file. The online help associated with the RGZPFM command lists these restrictions:


 During the reorganization of a physical member, the file being 
      reorganized is locked (similar to an *EXCL lock with no        
      time-out) for the time of the RGZPFM command so that no access 
      is possible.  Concurrent attempts by another job to use a      
      function that refers to the file may result in a "lock up" for 
      that work station until the running of the RGZPFM command is   
      completed.  Examples of commands that cannot be used on a file 
      that is concurrently being reorganized are:                    
      *  WRKACTJOB (Work with Active Jobs) (Select 11-Locks; Select 
      *  DSPDBR (Display Database Relations)                        
      *  DSPFD (Display File Description)                           
      *  DSPFFD (Display File Field Description)                    
      *  DSPJOB (Display Job) (Option 12-Display Locks; Option      
         14-Display Open files; F10-Job record locks)               
      *  WRKJOB (Work with Job) (Option 12-Display Locks; Option    
         14-Display Open files; F10-Job record locks)               
      *  WRKLIB (Work with Library) (The library that contains the  
         file being reorganized)                                    
      *  DSPOBJD (Display Object Description)                      
      *  WRKOBJLCK (Work with Object Locks)                        
      *  DSPRCDLCK (Display Record Locks)                          
      *  WRKOBJ (Work with Object Descriptions)                    
      *  DSPLIB (Display Library) (The library that contains the   
         file being reorganized)                                   
      *  WRKF (Work with Files)                                    
      *  Any other function that refers to the file being          

That said, there are products that can be used to reorganize a file while active.

These products create a duplicate copy of the file and it's indexes, runs the RGZPFM command against this copy and then deletes the original and replaces it with the copy. The only time no one can be using the file is during the few moments it takes to delete and replace.


Ask the Experts yourself: Our backup & recovery gurus are waiting to answer your questions.

Search400.com's targeted search engine: Get relevant information on backup & recovery.

Check out this Search400.com Featured Topic on backup & recovery.

Dig Deeper on Data backup, storage and retrieval on iSeries

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.