IBM AS/400 Frozen Dessert Maker User Manual


 
*-----------------------------------------------------------------*
* Start of subprocedure definition
*-----------------------------------------------------------------*
P SubProc B
D SubProc PI 5P 0
...
*-----------------------------------------------------------------*
* Body of code goes here including recovery code.
*-----------------------------------------------------------------*
C TryAgain TAG
C X DIV Divisor Result
C Return Result
*-----------------------------------------------------------------*
* An error occurs when division by zero takes place.
* Control is passed to the *PSSR subroutine.
*-----------------------------------------------------------------*
C *PSSR BEGSR
*-----------------------------------------------------------------*
* If this is a divide-by-zero error, add 1 to the divisor
* and try again
*-----------------------------------------------------------------*
C IF Err = 102
C ADD 1 Divisor
C GOTO TryAgain
C ENDIF
*-----------------------------------------------------------------*
* If control reaches ENDSR, the procedure will fail
*-----------------------------------------------------------------*
C ENDSR
P E
Figure 113. Example of Subprocedure *PSSR Subroutine with GOTO
234 ILE RPG for AS/400 Programmer's Guide