Returning from a Main Procedure
A return from a main procedure causes the following to occur:
- If it is a cycle-main procedure, and LR is on, then global files are closed and other resources are freed.
- The procedure's call stack entry is removed from the call stack.
- If the procedure was called by the program entry procedure, then that program entry procedure is also removed from the call stack.
A cycle-main procedure returns control to the calling
procedure in one of the following ways:
- With a normal end
- With an abnormal end
- Without an end.
A description of the ways to return from a called cycle-main procedure follows.
For a detailed description of where the LR, H1 through H9, and RT indicators are tested in the RPG program cycle, see the section on the RPG program cycle in the IBM® Rational® Development Studio for i: ILE RPG Reference.