|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 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.
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
FRPGLE11DSPCF E WORKSTN INDDS(Inds1) D inds1 DS D ISEXITPRESSED 3 3N /Free EXFMT RCDFMT1; IF isexitpressed; *inlr = *on; return; ENDIF; /End-Free
**FREE dcl-f RPGLE11DSP WORKSTN INDDS(Inds1); dcl-ds inds1; isexitpressed ind pos(3); end-ds; EXFMT RCDFMT1; IF isexitpressed; *inlr = *on; return; ENDIF;
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 ____________
- 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
- *LDA Local data area data structure in RPG AS400
- File information data structures (INFDS) 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