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

Fixed, /Free and Fully Free RPG


Indicator data structure in RPG AS400

Indicator data structure in RPG AS400
Indicator data structure in RPG AS400, data structure,ds, data structure in as400,indara, dspf, display file, indicatot, what, about, why, introduction
An indicator data structure in RPG AS400

Introduction to Indicator Data Structure

It is identified by the keyword INDDS with the file and it is used to store conditioning and response indicators for a file. %SIZE function used for Indicator data structure will return 99. Subfield may contain arrays of Indicator upto 99. By default, the indicator data structure is initialized to all zeros. It can be a multiple occurrence data structure as well

INDDS

INDDS keyword allows us to associate data structure with the INDARA indicators for the workstation/display file (DSPF) and the printer file(PRTF). The same data structure can be associated with multiple files.

Example of an Indicator data structure

We will now code the DSPF and an RPG program for demonstrating the use of the indicator data structure.

Create a DSPF using INDARA keyword

INDARA keyword is used to remove conditioning and response indicators from the buffer and place them in a 99-byte separate indicator area.

Below is the simple DSPF named RPGLE11DSP in library EASYCLASS1 having only one Record format named RCDFMT1 and having one field NAME and using INDARA keyword and command attention key indicator CA03(03)

     A                                      INDARA                         
     A                                      DSPSIZ(24 80 *DS3)             
     A                                      CA03(03)                       
     A          R RCDFMT1                                                  
     A                                  1 20'INDICATOR DATA STRUCTURE DEMO'
     A            NAME          10A  B  5 10                               

Create the Display file either using option 14 on the DSPF source member or using the CRTDSPF command.

Create an RPG program using an Indicator data structure in Fixed, /Free, and Fully free format.

Create the RPGLE named RPGLE11 either by taking option 14 on source member or using command CRTBNDRPG.

RPG Code in Fixed format for Indicator data structure in RPG AS400
     FRPGLE11DSPCF   E             WORKSTN INDDS(Inds1)    
     D inds1           DS                                  
     D  ISEXITPRESSED          3      3N                   
                                                           
     C                   EXFMT     RCDFMT1                 
     C                   IF        ISEXITPRESSED           
     C                   EVAL      *INLR = *ON  
     C	                 RETURN
     C                   ENDIF                                                                      
RPG Code in /Free format for Indicator data structure in RPG AS400
                           
     FRPGLE11DSPCF   E             WORKSTN INDDS(Inds1) 
     D inds1           DS                        
     D  ISEXITPRESSED          3      3N         
                                                 
      /Free                                      
          EXFMT RCDFMT1;                         
          IF isexitpressed;                      
            *inlr = *on;                         
            return;                              
          ENDIF;                                 
      /End-Free                                                                                                                                                         
RPG Code in Fully Free format for Indicator data structure in RPG AS400
**FREE                                
dcl-f RPGLE11DSP WORKSTN INDDS(Inds1);
dcl-ds inds1;                         
  isexitpressed ind pos(3);           
end-ds;                               
EXFMT RCDFMT1;                        
IF isexitpressed;                     
  *inlr = *on;                        
  return;                             
ENDIF;                                                   
  • Declared the DSPF RPGLE11DSP and associated inds1 indicator data structure with the file.
  • Then declared indicator data structure inds1 and its subfield IsExitPressed of length 1 and start position 3rd as we locate indicators in indicators array till 99 and 03 located on 3rd position.
  • Check if the F3 key is pressed then return from the program.
  • Program Output

    Once you called the program from the command line using the CALL command. The DSPF screen appears and once you take F3 you return from the program and if you press any other key nothing happens and you continue to be on the same DSPF screen.

                       INDICATOR DATA STRUCTURE DEMO            
                                                                
            ____________                                                        
                                                                
                                                                
                                                                
    

    Related Post

    Post a Comment

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