How to get rid of the *LR indicator

Reading RPG programs that are full of indicators is not my best thing. Although these days most of RPG fellas (myself included) use %BIFs (e.g. %EOF %FOUND %ERROR) replacing the traditiional indicators, we still use LR indicator usually at the end of our RPG Program.

The following program is a simple example of how we use of LR indicator

      dsply 'Hello World'; 
      *InLr = *On;         

The LR indicator can be eliminated in case we use the MAIN keyword in H-Card. The following example shows the way.

     H MAIN(MAIN_ENTRY)
     P MAIN_ENTRY      B
           dsply 'Hello World';
     P                 E     

When we CALL the above program, the procedure that is defined with the MAIN keyword is executed firstly.

Leave a comment