RPG/400 Help

BEGSR (Beginning of Subroutine)

*---------*---------------*-----------------*----------------*---------------*
|   CODE  |    FACTOR 1   |     FACTOR 2    |     RESULT     |  INDICATORS   |
|         |               |                 |      FIELD     |               |
*---------*---------------*-----------------*----------------*---------------*
| BEGSR   | Subroutine    |                 |                |               |
|         | name          |                 |                |               |
*---------*---------------*-----------------*----------------*---------------*

The BEGSR operation identifies the beginning of an RPG/400 subroutine. Factor 1 contains the subroutine name. You must specify the same name in factor 2 of the EXSR operation referring to the subroutine, in the result field of the CASxx operation referring to the subroutine, or in the entry of an INFSR file continuation option if the subroutine is a file-error subroutine. The control level entry (positions 7 and 8) can be SR or blank. Conditioning indicator entries are not permitted.

Every subroutine must have a unique symbolic name. The keyword *PSSR used in factor 1 specifies that this is a program exception/error subroutine to handle program-detected exception/errors. Only one subroutine can be defined by this keyword. *INZSR in factor 1 specifies a subroutine to be run during the initialization step. Only one subroutine can be defined *INZSR.

See Figure "Example of Coding Subroutines" for an example of coding subroutines; see Subroutine Operations for general information on subroutine operations.


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