| *LDA Local data area data structure in RPG AS400 | 
What is *LDA Local Data Area for IBM i
Run the below command to see the *LDA of your job.
dspdtaara *LDA
                               Display Data Area                      
                                                             System:  
 Data area . . . . . . . :   *LDA                                     
 Type  . . . . . . . . . :   *CHAR                                    
 Length  . . . . . . . . :   1024                                     
 Text  . . . . . . . . . :   *LDA for Job 003990/EASYCLASS/QPAD191838 
                                                                      
                                                                      
            Value                                                     
 Offset      *...+....1....+....2....+....3....+....4....+....5       
     0      '                                                  '      
    50      '                                                  '      
   100      '                                                  '      
   150      '                                                  '      
   200      '                                                  '      
   250      '                                                  '      
   300      '                                                  '      
   350      '                                                  '      
   400      '                                                  '      
What is *LDA Local data area data structure?
Declaring *LDA local data area data structure in Fixed format RPG
     D                UDS                          
     D subfld1                       10a                      
Or
     D ldaDS          UDS                  DTAARA(*LDA)  
     D subfld1                       10a                           
Declaring *LDA local data area data structure in Fully Free-format RPG
dcl-ds *n dtaara(*auto) ; subfld1 char(10); end-ds;
Or
dcl-ds ldaDS dtaara(*LDA) ; subfld1 char(10); end-ds;
Coding *LDA local data area data structure in RPGLE Fixed, /Free and Fully Free format.
In this example, we write data to *LDA local data area data structure.
    RPG Code in Fixed format for *LDA Local Data Area data structure in RPGLE AS400
  
  
  
  
      * unnanmed data area ds                                                             
      * don't require IN/OUT for *lda ds (INIT --> IN and TERM --> OUT)                  
      * created for each job. (1024 char (blank))                                        
      * dspdtaara *lda (cannot create, delete,allocate, no library associated with this)                                
     D                UDS                                         
     D subfld1                       10a         
      * You can define *LDA as below too. Currently below definition commented.                 
     D*ldaDS          UDS                  DTAARA(*LDA)           
     D*subfld1                       10a                                                                                     
     C                   EVAL      sbfld1 = 'hello lda'                                            
     C                   SETON                                            LR 
     C                   RETURN                                                                                     
  
    RPG Code in /Free format for *LDA Local Data Area data structure in RPGLE AS400
  
  
  
     D                UDS                                                               
     D subfld1                       10a   
      * You can define *LDA as below too. Currently below definition commented.                                                    
     D*ldaDS          UDS                  DTAARA(*LDA)                                 
     D*subfld1                       10a                                                
      /Free                                                                                                                                            
          subfld1 = 'hello lda';                                                        
          *inlr = *on;                                                                  
          return;                                                                       
      /End-Free                                                                                                                                                                                                                                                
 
  
  
    RPG Code in Fully Free format for *LDA Local Data Area data structure in RPGLE AS400 
  
  
**FREE                            
dcl-ds *N DTAARA(*AUTO);          
 subfld1 char(10);                
end-ds;                           
          subfld1 = 'hello lda';  
          *inlr = *on;            
          return;                                                               
  
    RPG Code in Fully Free format for *LDA Local Data Area data structure in RPGLE AS400 
**FREE                            
dcl-ds ldaDS DTAARA(*LDA);        
 subfld1 char(10);                
end-ds;                           
   IN ldaDS;                      
          subfld1 = 'hello lda';  
   OUT ldaDS;                     
          *inlr = *on;            
          return;                                                                              
  Output
                               Display Data Area                      
                                                             System:  
 Data area . . . . . . . :   *LDA                                     
 Type  . . . . . . . . . :   *CHAR                                    
 Length  . . . . . . . . :   1024                                     
 Text  . . . . . . . . . :   *LDA for Job 003990/EASYCLASS/QPAD191838 
                                                                      
                                                                      
            Value                                                     
 Offset      *...+....1....+....2....+....3....+....4....+....5       
     0      'hello lda                                         '      
    50      '                                                  '      
   100      '                                                  '      
   150      '                                                  '      
   200      '                                                  '      
   250      '                                                  '      
   300      '                                                  '      
   350      '                                                  '      
   400      '                                                  '      
                                                                      
 Press Enter to continue.                                             
Related Post
  
  Read also :
  
- Data Structure and Types of DS in RPG AS400
- Using a Data Structure to subdivide the field in RPG AS400
- Using a Data Structure to group fields in RPG AS400
- Externally Described Data Structure in RPG AS400
- Using EXTFLD to code Externally Described DS in RPG AS400
- Using PREFIX to rename all fields in an external data structure in RPG AS400
- Define an externally-described data structure using the LIKEREC keyword in RPG AS400
- Difference between LIKEREC and EXTNAME keyword in RPG AS400
- Multiple Occurrence Data Structure in RPG AS400
- Data Area Data Structure in RPG AS400
- File information data structures (INFDS) in RPG AS400
- Indicator data structure in RPG AS400
- Program Status Data Structure in RPG AS400
- Using keywords QUALIFIED, LIKEDS, and DIM with data structures
- Array Data Structures in RPG AS400
- Defining Data Structure Parameters in a Prototype or Procedure Interface