Where allowed to run:
|
Parameters Examples Error messages |
The End Subroutine (ENDSUBR) command specifies the end of a subroutine, and must be paired with a previous Subroutine (SUBR) command. When the ENDSUBR command is processed, control is returned to the command immediately following the Call Subroutine (CALLSUBR) command that called the subroutine. If a value is to be returned, such as an error code, the returned value must be able to be stored into a 4-byte signed integer CL variable. The Return value (RTNVAL) parameter can be a variable or constant. If no RTNVAL parameter is defined, the value will default to zero.
Restrictions:
Top |
Specifies the value to be returned from the subroutine. This can be a variable or constant that can be stored in a 4-byte signed integer CL variable. If the Call Subroutine (CALLSUBR) command that called the subroutine specified a CL variable for returned value, the variable is set to this value.
Top |
PGM : SUBR SUBR1 : ENDSUBR ENDPGM
This CL subroutine is identified by a SUBR command that contains the subroutine name, SUBR1, and is ended by the ENDSUBR command.
PGM : SUBR SUBR1 : ENDSUBR RTNVAL(-1) ENDPGM
This CL subroutine has an ENDSUBR command that returns a -1.
Top |
None
Top |