CL Command Reference - SUBR
CL Command List > SUBR Reference
Description:
The Subroutine (SUBR) command is used in a CL procedure, along with the End Subroutine (ENDSUBR) command, to delimit the group of commands that define a subroutine. The SUBR command defines the start of a subroutine. Subroutines may not be nested; therefore, an ENDSUBR command must end the current subroutine before the next SUBR command starts a new subroutine. A label specified on a SUBR command, or on a null command preceding the SUBR command, can be used as a target for a Go To (GOTO) command defined in the same subroutine. This GOTO command, when run, will pass control to the first executable statement in the subroutine.
Restrictions:
. This command is valid only within a CL procedure.
. The subroutine must be defined within a procedure, and must be located at the end of the procedure.
Examples:
PGM
:
SUBR SUBR1
:
ENDSUBR
ENDPGM
This SUBR command defines the start of a subroutine named SUBR1.