Reorganize physical file in AS400 - RGZPFM


§  We generally use RGZPFM to reuse the deleted records of a file for future insert operation. The data in a file in inserted sequentially. If we delete some in between records, then those freed spaces won’t be used for inserting new record. Like this, the toll of space accumulated by deleted records goes on and we cannot use them until and unless we run RGZPFM command to reorganize the space.

§  Once we delete the records the relative record number of the records gets changed due to reorganization of file.

§  Suppose a file is used in most of the programs based on its key value. If we want to change the access path of this file from sequential to keyed or from one key value to another key value, then we can go for RGZPFM.

 

Example:

Below records are according to arrival sequence.

ACCOUNT

        ORG   ACC           CCY  PARTY        
 000001 190   A00000000001  CCY  P00000000001 
 000002 191   A00000000002  EUR  P00000000002 
 000003 192   A00000000003  USD  P00000000003 
 000004 192   A00000000004  TRY  P00000000004 
 000005 190   A00000000005  INR  P00000000005 
 000006 190   A00000000006  TRY  P00000000006 
 000007 192   A00000000007  INR  P00000000007 
 000008 191   A00000000008  GBP  P00000000002 
 000009 191   A00000000009  USD  P00000000001 
 000010 195   A00000000010  EUR  P00000000003 
 000011 193   A00000000011  TRY  P00000000005 
 000012 192   A00000000012  EUR  P00000000002 
 000013 190   A00000000013  EUR  P00000000009 
 000014 191   P00000000014  USD  P00000000004 
 000015 192   A00000000015  INR  P00000000010 
 000016 192   A00000000016  GBP  P00000000011 
 000017 192   A00000000017  AZK  P00000000017 
 000018 191   A00000000018  EUR  P00000000014 
 000019 190   P00000000019  EUR  P00000000015 
 

 

 

Now we want to arrange the records according to the key value(ORG/ACC/CCY) of file ACCOUNT. For this we set the KEYFILE = *FILE.

If we want to arrange the records based on some other key value then we can give the logical file name containing that key value.

 


                     Reorganize Physical File Mbr (RGZPFM)    
                                                              
Type choices, press Enter.                                    
                                                              
Data base file . . . . . . . . . FILE         > ACCOUNT       
  Library  . . . . . . . . . . .              >   QGPL        
Member . . . . . . . . . . . . . MBR          > ACCOUNT       
Key file:                        KEYFILE                      
  Logical file . . . . . . . . .              > *FILE  >>>>>>>>>>>       
    Library  . . . . . . . . . .                              
  Member . . . . . . . . . . . .                              
Rebuild access paths . . . . . . RBDACCPTH      *YES           
Allow cancel . . . . . . . . . . ALWCANCEL    > *NO           
                                                              
                           Additional Parameters              
                                                               
Source update options  . . . . . SRCOPT         *SAME    



After reorganizing, the records in ACCOUNT get arranged as per the key value of ACCOUNT.

 

       ORG   ACC           CCY  PARTY      
000001 190   A00000000001  CCY  P00000000001
000002 190   A00000000005  INR  P00000000005
000003 190   A00000000006  TRY  P00000000006
000004 190   A00000000013  EUR  P00000000009
000005 190   P00000000019  EUR  P00000000015
000006 191   A00000000002  EUR  P00000000002
000007 191   A00000000008  GBP  P00000000002
000008 191   A00000000009  USD  P00000000001
000009 191   A00000000018  EUR  P00000000014
000010 191   P00000000014  USD  P00000000004
000011 192   A00000000003  USD  P00000000003
000012 192   A00000000004  TRY  P00000000004
000013 192   A00000000007  INR  P00000000007
000014 192   A00000000012  EUR  P00000000002
000015 192   A00000000015  INR  P00000000010
000016 192   A00000000016  GBP  P00000000011
000017 192   A00000000017  AZK  P00000000017
000018 193   A00000000011  TRY  P00000000005
000019 195   A00000000010  EUR  P00000000003

 











User Comments:



Subscribe

.  


Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy