Exception Handling within a Cycle-Main Procedure

When an exception occurs within a cycle-main procedure ILE RPG does the following:

  1. If an error indicator is present on the calculation specification and the exception is one that is expected for that operation:
    1. The indicator is set on
    2. The exception is handled
    3. Control resumes with the next ILE RPG operation.
  2. If an 'E' operation code extender is present on the calculation specification and the exception is one that is expected for that operation:
    1. The return values for the built-in funtions %STATUS and %ERROR are set.
      Note:
      %STATUS is set when any exception occurs even if the 'E' extender is not specified.
    2. The exception is handled
    3. Control resumes with the next ILE RPG operation.
  3. If no error indicator or 'E' extender is persent and the code that generates the exception is in the MONITOR block of a MONITOR group, control will pass to the on-error section of the MONITOR group.
  4. If no error indicator or 'E' extender is present, no active MONITOR group could handle the exception, and

    then the exception will be handled and control will resume at the first statement of the error subroutine.

  5. If no error indicator, 'E' extender, or error subroutine is coded and no active MONITOR group could handle the exception, then the RPG default error handler is invoked.

See Unhandled Exceptions for a full description of the RPG default handler.



[ Top of Page | Previous Page | Next Page | Contents | Index ]