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

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.

Type
*INT4
Required
No
Default
0
Case
Uppercase

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.

IBM command documentation

Generated from os/cl/catalog/ENDSUBR.json and os/cl/help/ENDSUBR.json.