Command reference / CL

SUBR

Subroutine

Used with ENDSUBR in a CL program or ILE CL procedure to delimit the group of commands that define a subroutine. The SUBR command starts the subroutine, and subroutines cannot be nested, so an ENDSUBR must end the current subroutine before the next SUBR starts another. A label on SUBR, or on a null command just before it, can be the target of a GOTO in the same subroutine, which then passes control to the subroutine's first executable statement.

Allowed environments: *BPGM, *IPGM. Use within a CL program. Positional parameters: 1.

Restrictions

Parameters

SUBR Subroutine

Names the subroutine. This is the name that must be specified on a CALLSUBR command. Required, positional 1. Must be a simple name; a CL variable name cannot be used.

Type
*SNAME
Required
Yes
Length
10
Case
Uppercase

Examples

SUBR SUBR1

Within a PGM ... ENDPGM block, this SUBR command defines the start of a subroutine named SUBR1, ended by ENDSUBR.

IBM command documentation

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