Figure 2 shows the specific steps in the
RPG IV exception/error
handling routine. The item numbers in the following description refer
to the numbers in the figure.
- 1
- Set up the file information or procedure status data structure,
if specified, with status information.
- 2
- If the exception/error occurred on an operation code that has
an indicator specified in positions 73 and 74, the indicator is set
on, and control returns to the next sequential instruction in the
calculations.
- 3
- If the appropriate exception/error subroutine (INFSR or *PSSR)
is present in the procedure, the procedure branches to step 13; otherwise,
the procedure continues with step 4.
- 4
- If the Status code is 1121-1126 (see File Status Codes),
control returns to the current instruction in the calculations. If
not, the procedure continues with step 5.
- 5
- If the exception is a function check, the procedure continues
with step 6. If not, it branches to step 15.
- 6
- An inquiry message is issued to the requester. For an interactive
job, the message goes to the requester. For a batch job, the message
goes to QSYSOPR. If QSYSOPR is not in break mode, a default response
is issued.
- 7
- If the user's response is to cancel the procedure, the
procedure continues with step 8. If not, the procedure continues.
- 8
- If the user's response is to cancel with a dump, the procedure
continues with step 9. If not, the procedure branches to step 10.
- 9
- A dump is issued.
- 10
- All global files are closed and data areas are unlocked
- 11
- The procedure is set so that it can be called again.
- 12
- The return code is set and the function check is percolated.
- 13
- Control passes to the exception/error subroutine (INFSR or *PSSR).
- 14
- If a return point is specified in factor 2 of the ENDSR operation
for the exception/error subroutine, the procedure goes to the specified
return point. If a return point is not specified, the procedure goes
to step 4. If a field name is specified in factor 2 of the ENDSR
operation and the content is not one of the RPG IV-defined return
points (such as *GETIN or *DETC), the procedure goes to step 6. No
error is indicated, and the original error is handled as though the
factor 2 entry were blank.
- 15
- If no invocation handles the exception, then it is promoted
to function check and the procedure branches to step 5. Otherwise,
depending on the action taken by the handler, control resumes in this
procedure either at step 10 or at the next machine instruction after
the point at which the exception occurred.