From ancient times we RPG programmers have been using INDICATORS from handling display files to tracking errors. But maintaining source with indicators in INXX(XX= 01 to 99) form is always hard. So, the concept of “Named Indicators” gives programmers power to give readable long names to Indicators which are easy to maintain.
Here how we can use Named Indicators in RPG:
Using Pointer and DS.
D pIndicators S * Inz(%Addr(*In))
D Indicators DS Based(pIndicators)
D ExitKey N Overlay(Indicators:3)
D PromptKey N Overlay(Indicators:4)
D RefershKey N Overlay(Indicators:5)
D ClearSubfile N Overlay(Indicators:41)
D N Overlay(Indicators:42)
Now in your RPG code you don’t need to use *IN03 = *ON instead you can use ExitKey = *On. For Example, in free format RPG you can write code something like this :
DoW ExitKey = *Off; DisplaySubfileControl = *Off; ClearSubfile = *On; Write SUBFILE_CONTROL_FORMAT; ClearSubfile = *Off ; EndDo;
Wise words from IBM-
The INDDS keyword lets you associate a data structure name with the INDARA indicators for a workstation or printer file. This data structure contains the conditioning and response indicators passed to and from data management for the file, and is called an indicator data structure.
In simple words-
- Your Display or Printer file must contain INDARA keyword at File Level.
Example how to use INDDS in RPG:
FExample1 CF E WORKSTN INDDS(dispInds) D dispInds DS D ExitKey N Overlay(dispInds:3) D PromptKey N Overlay(dispInds:4) D RefershKey N Overlay(dispInds:5) D ClearSubfile N Overlay(dispInds:41) D DisplaySubfileControl... D N Overlay(dispInds:42)
This method removes the connection between *INXX indicators and Display file(or printer file). Now, if you need to track whether F3 key is pressed or not you cannot use *In03 instead you have to use ExitKey = *ON.
INDDS will be different for each file. So if you are using multiple display files you have to track F3 using their respective INDDS indicator names.
Any question drop a mail to email@example.com