AS400 interview questions and answers-Part 2


1. What is the use of RGZPFM? Give example of RGZPFM.

Ans:

Ø  Reorganize physical file member(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

 

 

2. How to create a multi-member physical file?

Ans:

 

¤  TO ADD A NEW MEMBER TO THE FILE USING ADDPFM

 

 

PRESS F6


                        Add Physical File Member (ADDPFM)                      
                                                                               
 Type choices, press Enter.                                                    
                                                                                
 Physical file  . . . . . . . . . > ACCOUNT          Name                         
   Library  . . . . . . . . . . . >   AMINEM        Name, *LIBL, *CURLIB         
 Member . . . . . . . . . . . . .   ________      Name                          
 Text 'description' . . . . . . .   *BLANK                                     
                                                                               
           
                                                                                
                                                                               
                                                                               
                                                                         Bottom
 F3=Exit   F4=Prompt   F5=Refresh   F10=Additional parameters   F12=Cancel     
 F13=How to use this display        F24=More keys                              


 

 

ADDPFM FILE(AMINEM/ACCOUNT) MBR(MBR2)             

Member MBR2 added to file ACCOUNT in AMINEM.                

STRDFU => SELECT member as MBR2 to add record in the new member.

 

 

 


                           Work with Members Using PDM                 SYSTEM09
                                                                                
 File  . . . . . .   ACCOUNT                                                      
   Library . . . .     AMINEM                 Position to  . . . . .             
                                                                                
 Type options, press Enter.                                                    
   3=Copy    4=Delete         5=Display   7=Rename    8=Display description    
   9=Save    13=Change text   18=Change using DFU     25=Find string ...       
                                                                               
 Opt  Member      Date        Text                                             
      ACCOUNT        05/21/12                                                      
      MBR2        07/23/12         >>>>>>> New member MBR2 added to the file ACCOUNT
                                                                               
                                                                                
                                                                               
                                                                         Bottom
 Parameters or command                                                          
 ===> ____________________________________________________________________________
__________________________________________________________________________________
                                                                         
 F3=Exit          F4=Prompt             F5=Refresh            F6=Create        
 F9=Retrieve      F10=Command entry     F23=More options      F24=More keys


 

 

ACCOUNT/MBR2

 


       ACLEVELID  ACORGCOD       ACCOUNTNUM   ACCURRENCY  ACNAME
000001      7        190    200,000,000,001      EUR      HIMESH
000002      7        190    200,000,000,002      USD      SUKIN
000003      7        190    200,000,000,004      USD      SANKY
000004      7        190    200,000,000,005      CHF      PAINK

             

 

 

¤  TO ADD A NEW MEMBER TO THE FILE USING CPYF

 

 

CPYF FROMFILE(AMINEM/ACCOUNT) TOFILE(AMINEM/ACCOUNT) FROMMBR(ACCOUNT) TOMBR

(MBR3) MBROPT(*ADD) CRTFILE(*NO) FROMRCD(1) NBRRCDS(3)

Member MBR3 added to file ACCOUNT in AMINEM.

3 records copied from member ACCOUNT.

 

 

MEMBER WILL BE CREATED AND RECORD WILL BE ADDED TO THIS MBR.

 

 


                           Work with Members Using PDM                 SYSTEM09
                                                                               
 File  . . . . . .   ACCOUNT                                                      
   Library . . . .     AMINEM                 Position to  . . . . .             
                                                                                
 Type options, press Enter.                                                    
   3=Copy    4=Delete         5=Display   7=Rename    8=Display description    
   9=Save    13=Change text   18=Change using DFU     25=Find string ...       
                                                                               
 Opt  Member      Date        Text                                             
      ACCOUNT     05/21/12                                                      
      MBR2        07/23/12        
      MBR3        07/23/12    >>>>>>> New member MBR2 added to the file ACCOUNT
                                                                               
                                                                                
                                                                               
                                                                         Bottom
 Parameters or command                                                          
 ===>                                                                          
 F3=Exit          F4=Prompt             F5=Refresh            F6=Create        
 F9=Retrieve      F10=Command entry     F23=More options      F24=More keys     

 

 

  

 

¤ Copy member


                           Work with Members Using PDM                 NLAAB441
                                                                               
 File  . . . . . .   PRJ1                                                       
   Library . . . .     AMINEM               Position to  . . . . .             
                                                                               
 Type options, press Enter.                                                     
  2=Edit         3=Copy  4=Delete 5=Display       6=Print     7=Rename         
  8=Display description  9=Save  13=Change text  14=Compile  15=Create module...
                                                                                
 Opt  Member      Type        Text                                             
 _3_  MASTER      PF          ACCOUNT RELATED INFORMATION                      
      MENUC       CLP         TO CALL MENU                                      
      MNU0        MNUDDS                                                       
      MNU0QQ      MNUCMD                                                       
      OPT1_PGM    RPG         entry pgm to be called for option-1              
      OPT2_PGM    RPG         entry pgm to be called for option-2              
      OPT3_PGM    RPGLE       entry pgm to be called for option-3              
      OPT4_PGM    SQLRPGLE    entry pgm to be called for option-4              
                                                                        More...
 Parameters or command                                                         
 ===>                                                                          
 F3=Exit          F4=Prompt             F5=Refresh            F6=Create        
 F9=Retrieve      F10=Command entry     F23=More options      F24=More keys   
 


 

 

 

 


                                 Copy Members                                  
                                                                               
 From file . . . . . . . :   PRJ1                                              
   From library  . . . . :     AMINEM                                           
                                                                               
 Type the file name and library name to receive the copied members.            
                                                                                
   To file . . . . . . . .   PRJ1         Name, F4 for list                    
     To library  . . . . .     AMINEM                                          
                                                                                
 To rename copied member, type New Name, press Enter.                          
                                                                               
 Member         New Name                                                       
 MASTER         MASTER                                                         
                                                                               
                                                                              
                                                                               
                                                                                
                                                                         Bottom
 F3=Exit             F4=Prompt     F5=Refresh     F12=Cancel                   
 F19=Submit to batch                                                           


 






 

 







User Comments:



Subscribe

  Email:



Copyright © www.go4as400.com, 2013-2020. Copyright notice