Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


Using PREFIX to rename all fields in an external data structure in RPG AS400

Using PREFIX to rename all fields in an external data structure in RPG AS400
Using PREFIX to rename all fields in an external data structure in RPG AS400. PREFIX keyword in rpg, externlly described data structure in rpgle, data structure, ds, create, make, introduction, about
Using PREFIX to rename all fields in an external data structure in RPG AS400

In this blog, we will discuss the coding example of using the PREFIX keyword to rename all the fields of and externally described data structure in RPGLE Fixed, /Free and Fully free format

Coding for Rename all fields using PREFIX in an Externally described data structure

RPG Code in Fixed format for Renaming all fields in Externally Described Data Structure
                            
     D ds1           E DS                  EXTNAME(rpgle14pf:Rcdfmt14)  
     D                                     PREFIX(a1)
     C                   EVAL      a1IDN = 2                               
     C                   EVAL      a1Name = 'DUMMY'                        
     C                   EVAL      a1Addr1 = 'Address1'                    
     C                   EVAL      a1Addr2 = 'Address2'                                                              
     C                   SETON                                        LR   
     C                   RETURN                                                                           
RPG Code in /Free format for Renaming all fields in Externally Described Data Structure
     * Externally described data structure                           
     * --> external definition used for ds.                          
    D ds1           E DS                  EXTNAME(rpgle14pf:Rcdfmt14)     
    D                                     PREFIX(a1)        
     /Free                                                           
          a1IDN = 2;                                                 
          a1Name = 'DUMMY';                                          
          a1Addr1 = 'Address1';                                      
          a1Addr2 = 'Address2';                                      
          *inlr = *on;                                               
          return;                                                    
     /End-Free                                                                                                                                                             
RPG Code in fully Free format for Renaming all fields in Externally Described Data Structure
**FREE                                 
 DCL-DS DS1 EXTNAME('RPGLE14PF') PREFIX(a1);     
 END-DS;                               
           a1IDN = 2;                    
           a1Name = 'DUMMY';             
           a1Addr1 = 'Address1';         
           a1Addr2 = 'Address2';         
           *inlr = *on;                
           return;                                               

Related Post

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain