Where allowed to run:
|
Parameters Examples Error messages |
The Return from Subroutine (RTNSUBR) command returns control to the command immediately following the Call Subroutine (CALLSUBR) command that called the subroutine. The RTNSUBR command must be used within a subroutine, and multiple RTNSUBR commands may be used in a 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 : IF (&A *LT 30) THEN(RTNSUBR RTNVAL(-1)) : ENDSUBR ENDPGM
This CL subroutine is exited by the RTNSUBR command if &A is less than 30, with a return value of -1.
Top |
None
Top |