The following examples illustrate the behavior of EXIT PROGRAM, STOP RUN, and GOBACK in various combinations of Named, *NEW, and *DFTACTGP activation groups.

| Statement | Program A | Program B | Program C | Program D | Program E |
|---|---|---|---|---|---|
| EXIT PROGRAM | 1 | 4 | 4 | 2 | 2 |
| STOP RUN | 3 | 3 | 3 | 3 | 3 |
| GOBACK | 3 | 4 | 4 | 2 | 2 |

| Statement | Program A | Program B | Program C | Program D | Program E |
|---|---|---|---|---|---|
| EXIT PROGRAM | 1 | 5 | 1 | 2 | 2 |
| STOP RUN | 3 | 3 | 4 | 4 | 4 |
| GOBACK | 3 | 5 | 4 | 2 | 2 |

| Statement | Program A | Program B | Program C | Program D | Program E |
|---|---|---|---|---|---|
| EXIT PROGRAM | 1 | 5 | 1 | 2 | 2 |
| STOP RUN | 3 | 4 | 4 | 2 | 4 |
| GOBACK | 3 | 4 | 4 | 2 | 2 |
If an EXIT PROGRAM statement with the CONTINUE phrase was used, control is returned to the calling program or command. In a *NEW activation group, when a main program returns control to the caller, the activation group is ended. The activation group will close all files scoped to the activation group. Any pending commit operation scoped to the activation group will be implicitly committed.
All resources allocated to the activation group will be returned back to the system. As a result of the activation group ending, all programs that were active in the activation group are placed in their initial state.

| Statement | Program A | Program B | Program C | Program D | Program E |
|---|---|---|---|---|---|
| EXIT PROGRAM | 1 | 6 | 7 | 2 | 2 |
| STOP RUN | 3 | 4 | 5 | 2 | 5 |
| GOBACK | 3 | 4 | 5 | 2 | 2 |
If an EXIT PROGRAM statement with the CONTINUE phrase was used, control is returned to the calling program or command.
In a *NEW activation group, when a main program returns control to the caller, the activation group is ended. The activation group will close all files scoped to the activation group. Any pending commit operation scoped to the activation group will be implicitly committed.
All resources allocated to the activation group will be returned back to the system. As a result of the activation group ending, all programs that were active in the activation group are placed in their initial state.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.