# jCL RTN
Updated: 10/19/2021, 9:29:48 PM
Created: 10/19/2021, 9:29:48 PM
Last Updated By: Kevin Munoz
Read Time: 1 minute(s)
Tags: subroutine jcl
This command terminates execution of an external subroutine and returns control to a statement following the [ ] command that called the subroutine. It takes the general form:
Where n specifies that control should be returned to the n'th statement line after the calling [ ] command. Can be a number, or a direct or indirect reference to a buffer or select register.
If n is not specified, control will return to the statement immediately following the calling [ ] command. A RTN without a corresponding [ ] command will terminate the program.
# Example 1
| Menu | Menu 2 | | ---- | ------ | | 051 [SUBS MENU2] | 066 RTN | | 052 | | | 053 | |
jCL program MENU calls MENU2 from line 51. When MENU2 reaches line 66, control will be returned to MENU at line 52.
# Example 2
| Menu | Menu2 | | ---- | ----- | | 051 [SUBS MENU2] | 066 RTN 2 | | 052 | | | 053 | |
jCL program MENU calls MENU2 from line 51. When MENU2 reaches line 66, control will be returned to MENU at line 53.
Back to jCL.