# jCL RTN

Updated: 10/23/2020, 1:48:27 PM
Created: 10/23/2020, 1:48:27 PM
Last Updated By: Mike Street
Read Time: 1 minute(s)

Tags: subroutine jcl

# Description

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:

RTN{n}
1

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.

# Note

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              |                  |
1
2
3
4
5

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               |                  |
1
2
3
4
5

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.