IBM AS/400 Frozen Dessert Maker User Manual


 
When you specify an error indicator or an 'E' extender on an operation code, you
can explicitly call a file error subroutine (INFSR) or a program error subroutine
(*PSSR) with the EXSR operation. If either INFSR or *PSSR is explicitly called by
the EXSR operation and Factor 2 of the ENDSR operation is blank or the field
specified has a value of blank, control returns to the next sequential instruction fol-
lowing the EXSR operation.
Table 15. Operation Codes Allowing Extender 'E' or an Error Indicator in Positions
73-74
ACQ (e) ADDDUR (e) ALLOC (e) CALL (e)
CALLB(d e) CALLP (e m/r)
1
CHAIN (e n) CHECK (e)
CHECKR (e) CLOSE (e) COMMIT (e) DEALLOC(e/n)
DELETE (e) DSPLY (e) EXFMT (e) EXTRCT (e)
FEOD (e) IN (e) NEXT (e) OCCUR (e)
OPEN (e) OUT (e) POST (e) READ (e n)
READC (e) READE (e n) READP (e n) READPE (e n)
REALLOC (e) REL (e) RESET (e) ROLBK (e)
SCAN (e) SETGT (e) SETLL (e) SUBDUR (e)
SUBST (e p) TEST (e d/t/z) UNLOCK (e) UPDATE (e)
WRITE (e) XLATE (e p)
Notes:
1. CALLP (e m/r) is an extended Factor-2 operation code and cannot have an error
indictator. However, program status and error conditions can be determined by spec-
ifying the 'e' extender with this operation code.
Using an Error Subroutine
When you write a error subroutine you are doing two things:
1. Enabling the RPG subroutine error handler
The subroutine error handler will handle the exception and pass control to your
subroutine.
2. Optionally specifying a recovery action.
You can use the error subroutine to take specific actions based on the error
which occurred or you can have a generic action (for example, issuing an
inquiry message for all errors).
The following considerations apply to error subroutines:
You can explicitly call an error subroutine by specifying the name of the sub-
routine in Factor 2 of the EXSR operation.
You can control the point where processing resumes in a main procedure by
specifying a value in Factor 2 of the ENDSR operation of the subroutine. In a
subprocedure, factor 2 of the ENDSR must be blank. Use either a GOTO or a
RETURN operation prior to the ENDSR operation to prevent the subprocedure
from ending abnormally.
If an error subroutine is called, the RPG error subroutine handler has already
handled the exception. Thus, the call to the error subroutine reflects a return to
program processing. If an exception occurs while the subroutine is running, the
228 ILE RPG for AS/400 Programmer's Guide