Command reference / CL
ENDSUBR
End Subroutine
Specifies the end of a subroutine and must be paired with a previous SUBR command. When processed, control returns to the command immediately after the CALLSUBR command that called the subroutine. A returned value, such as an error code, must be storable in a 4-byte signed integer CL variable. If no RTNVAL parameter is defined, the value defaults to zero.
Allowed environments: *BPGM, *IPGM.
Use within a CL program.
Positional parameters: 0.
Restrictions
- Valid only within a CL program or ILE CL procedure.
- The subroutine must be defined within a procedure and must be located at the end of the procedure.
Parameters
RTNVAL
Return value
Specifies the value returned from the subroutine. It can be a variable or constant that can be stored in a 4-byte signed integer CL variable. If the CALLSUBR command specified a CL variable for the returned value, that variable is set to this value.
Examples
ENDSUBR
Ends subroutine SUBR1, which was identified by a SUBR command. Returns zero by default.
ENDSUBR RTNVAL(-1)
This CL subroutine returns a -1.
Generated from os/cl/catalog/ENDSUBR.json and os/cl/help/ENDSUBR.json.