Returning without Ending for a Cycle-Main Procedure
A cycle-main procedure can return control to the calling
procedure without ending when none of the LR or H1 through H9 indicators are
on and one of the following occurs:
The RETURN operation (with a blank factor 2) is processed.
The RT indicator is on and control reaches the *GETIN part of the RPG
cycle, in which case control returns immediately to the calling procedure.
(For further information on the RT indicator, see the IBM Rational Development Studio for i: ILE RPG Reference)
If you call a cycle-main procedure and it returns without
ending, when you call the procedure again, all fields, indicators, and files
in the procedure will hold the same values they did when you left the procedure.
However, there are three exceptions:
This is not true if the program is running in a *NEW activation group,
since the activation group is deleted when the program returns. In that case,
the next time you call your program will be the same as if you had ended with
LR on.
If you are sharing files, the state of the file may be different from
the state it held when you left the procedure.
If another procedure in the same module was called in between, then the
results are unpredictable.
You can use either the RETURN operation (with a blank factor 2) or the
RT indicator in conjunction with the LR indicator and the H1 through H9 indicators.
Be aware of the testing sequence in the RPG program cycle for the RETURN operation,
the RT indicator, and the H1 through H9 indicators. A return will cause an
end if the LR indicator or any of the halt indicators is on and either of
the following conditions is true: