Rational Developer for System z
COBOL for Windows, Version 7.5, Programming Guide


Ending multithreaded programs

You can end a multithreaded program by using GOBACK or EXIT PROGRAM.

Use GOBACK to return to the caller of the program. When you use GOBACK from the first program in a thread, the thread is terminated.

Use EXIT PROGRAM as you would GOBACK, except from a main program where it has no effect.

When the COBOL environment is not preinitialized, and the COBOL run time can determine that there are no other COBOL programs active in the run unit, the COBOL process for terminating a run unit (including closing all open COBOL files) is performed upon the GOBACK from the first program of this thread. This determination can be made if all COBOL programs that are called within the run unit have returned to their callers through GOBACK or EXIT PROGRAM. This determination cannot be made under certain conditions such as the following:

There is no COBOL function that effectively does a STOP RUN in a threaded environment. If you need this behavior, consider calling the C exit function from your COBOL program and using _iwzCOBOLTerm after the runtime termination exit.

related tasks
Ending and reentering main programs or subprograms


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)