The enclave defines the scope of language statements

The enclave defines the scope of language statements — for example, those that stop execution of the outermost routine within an enclave. C's exit(), COBOL's STOP RUN, Fortran's STOP and END statements, and PL/I’s STOP and EXIT statements are examples of such statements. When one of these statements is executed, the main routine within the enclave terminates. Thus, the enclave defines the scope of the language statements.

Before returning, resources obtained by the routines in the enclave are released and any open files (other than the Language Environment message file) are closed.