Specifying a Return Point in the ENDSR Operation

When using an INFSR or *PSSR error subroutine in a cycle-main procedure, you can indicate the return point at which the program will resume processing, by entering one of the following as the Factor 2 entry of the ENDSR statement. The entry must be a six-position character field, literal, named constant, array element, or table name whose value specifies one of the following return points.

Note:
If the return points are specified as literals, they must be enclosed in apostrophes and entered in uppercase (for example, *DETL, not *detl). If they are specified in fields or array elements, the value must be left-adjusted in the field or array element.

*DETL
Continue at the beginning of detail lines.
*GETIN
Continue at the get input record routine.
*TOTC
Continue at the beginning of total calculations.
*TOTL
Continue at the beginning of total lines.
*OFL
Continue at the beginning of overflow lines.
*DETC
Continue at the beginning of detail calculations.
*CANCL
Cancel the processing of the program.
Blanks
Return control to the ILE RPG default exception handler. This will occur when Factor 2 is a value of blanks and when Factor 2 is not specified. If the subroutine was called by the EXSR operation and Factor 2 is blank, control returns to the next sequential instruction.

After the ENDSR operation of the INFSR or the *PSSR subroutine is run, the ILE RPG compiler resets the field or array element specified in Factor 2 to blanks. Because Factor 2 is set to blanks, you can specify the return point within the subroutine that is best suited for the exception that occurred.

If this field contains blanks at the end of the subroutine, the ILE RPG default exception handler receives control following the running of the subroutine, unless the INFSR or the *PSSR subroutine was called by the EXSR operation. If the subroutine was called by the EXSR operation and Factor 2 of the ENDSR operation is blank, control returns to the next sequential instruction following the EXSR operation.

Note:
You cannot specify a factor 2 entry for an ENDSR in a subprocedure. If you want to resume processing in the subprocedure, you have to use a GOTO operation to a TAG in the body of the subprocedure. Alternatively, you can code a RETURN operation in the *PSSR. The subprocedure will then return to the caller.


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