RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

Name your Indicators Print E-mail
User Rating: / 3
Written by Chamara Withanachchi   
Name your Indicators

Naming your numeric indicators used in screen displays or printer files is an effective way to make your programs more readable and understandable. You can do this by associating a data structure using the INDDS keyword or address association using the BASED keyword.

Within the data structure you give each indicator you use a unique name. So instead of saying IF *IN99 = *ON, you can say IF ERROR = *ON. This provides someone who has never been in the program before a better understanding of what the test is, instead of having to hunt down every occurrence of the indicator and figure it out from there.

    FWS1234DF  CF   E             WORKSTN INDDS(Indicators)

    DIndicators       DS                                      
    D InPageUp            25     25N                       
    D InPageDown          26     26N                       
    D InSflDspctl         40     40N                       
    D InSflDsp            41     41N                       
    D InSflClr            42     42N                       
    D InSflEnd            45     45N                       
    D InPC_Run            60     60N                       
    D InPC_ChkDt          61     61N                       
    D InPC_Cntrl#         62     62N

The keyword INDDS references a data structure named Indicators.

The other method uses the BASED keyword. It is similar to the first method except it does not require changes to the file specifications or either the display or printer files;

    DIndicators       S               *   INZ(%Addr(*IN))         
    D                 DS                  BASED(Indicators)       
    D InPageUp            25     25N                       
    D InPageDown          26     26N                       
    D InSflDspctl         40     40N   

%ADDR references the Indicator array, and BASED references the data structure you provide.

<Previous   Next>