ILE COBOL Programmer's Guide

Returning from a Main Program

To return control from a main program, you use either STOP RUN, GOBACK, or EXIT PROGRAM with the CONTINUE phrase. The STOP RUN and GOBACK statements end the run unit, and control is returned to the caller of the main program. EXIT PROGRAM without the CONTINUE phrase cannot be used to return control from a main program. When EXIT PROGRAM without the CONTINUE phrase is encountered in a main program, no operation is performed and processing continues at the next statement in the main program.

Returning from a *NEW Activation Group

When the STOP RUN, GOBACK, or an EXIT PROGRAM with the CONTINUE phrase are performed from a called main ILE COBOL program in a *NEW activation group, the activation group is ended when control is returned to the calling program. The activation group will close all files and return all resources] back to the system.

As a result of the activation group ending, the called ILE COBOL program is placed in its initial state.

Returning from a Named Activation Group

When an EXIT PROGRAM with the CONTINUE phrase is performed from a called main ILE COBOL program in a named activation group, the activation group remains active and control is returned to the calling program. All files and resources in the activation group are left in their last used state.

When the STOP RUN or GOBACK statements are performed from a called main ILE COBOL program in a named activation group, the activation group is ended when control is returned to the calling program. The activation group will close all files and return all resources back to the system.

Returning from the Default (*DFTACTGRP) Activation Group

When the STOP RUN or GOBACK statements are performed from a called main ILE COBOL program in the default (*DFTACTGRP) activation group, the activation group remains active and control is returned to the calling program. All files and resources used in the activation group are left in their last used state.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]