A cycle-main procedure ends abnormally and control returns
to the calling procedure when one of the following occurs:
- The cancel option is taken when an ILE RPG inquiry message is issued.
- An ENDSR *CANCL operation in a *PSSR or INFSR error subroutine is processed.
(For further information on the *CANCL return point for the *PSSR and INFSR
error subroutines, see Specifying a Return Point in the ENDSR Operation).
- An H1 through H9 indicator is on when a RETURN operation (with a blank
factor 2) is processed.
- An H1 through H9 indicator is on when last record (LR) processing occurs
in the RPG cycle.
When a cycle-main procedure ends abnormally, the following
occurs:
- All global files that are open are closed.
- Any data areas locked by the procedure are unlocked.
- If the cycle-main procedure ended because of a cancel reply to
an inquiry message, then it was a function check that caused the abnormal
end. In this case, the function check is percolated to the caller. If it
ended because of an error subroutine ending with '*CANCL', then escape message
RNX9001 is issued directly to the caller. Otherwise the caller will see whatever
exception caused the abnormal end.
On the next call to the procedure, a fresh copy is available for processing.
(For more information on exception handlers, see Using RPG-Specific Handlers.)