Using RENAME in the File Specs


There are times when you will be writing an RPG program that uses both physical and logical files. When using both a physical file and logic file, both having the same record name, and updating or writing to records, the keyword RENAME must be used to differentiate between which record name is to be updated. Figures 1 and 2 show the file specs for RPG and RPG ILE.


Figure 1 - Using RENAME in RPG

 FMT FX .....FFilenameIPEAF........L..I........Device+......KExit++Entry+A....U 
0059.00      FTCLTRNK1IF  E           K        DISK                             
0060.00      FTCPRACY UF  E           K        DISK                             
0061.00      FTCPRACY1O   E                    DISK                      A      
0062.00      F            RACY                              KRENAMERA1          
0063.00      FTCPRACY2O   E                    DISK                      A      
0064.00      F            RACY                              KRENAMERA2          
0065.00      FTCLRACY     E                    DISK                      A    U 
0066.00      F            RACY                              KRENAMERA3          


Figure 2 - Using RENAME in RPG ILE

 FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++
0114.00 FTCLTRNK1  IF   E           K DISK                                     
0115.00 FTCPRACY   UF   E           K DISK                                     
0116.00 FTCPRACY1  O  A E             DISK                                     
0117.00 F                                     RENAME(RACY:RA1)                 
0118.00 FTCPRACY2  O  A E             DISK                                     
0119.00 F                                     RENAME(RACY:RA2)                 
0120.00 FTCLPRACY  O  A E             DISK    USROPN                           
0121.00 F                                     RENAME(RACY:RA3)                 

Back to Tips and Techniques    |    Back to Main Page    |   Contact Info