THREAD indicates that a COBOL program is to be enabled for execution in a Language Environment enclave that has multiple POSIX threads or PL/I tasks.
THREAD option syntax .-NOTHREAD-. >>-+----------+------------------------------------------------>< '-THREAD---'
Default is: NOTHREAD
Abbreviations are: None
A program that has been compiled with the THREAD option can also be used in a nonthreaded application. However, if a COBOL program is to be run in a threaded application, all the COBOL programs in the Language Environment enclave must be compiled with the THREAD option.
NOTHREAD indicates that the COBOL program is not to be enabled for execution in an enclave that has multiple POSIX threads or PL/I tasks.
Programs compiled using compilers earlier than Enterprise COBOL are treated as if compiled with NOTHREAD.
When the THREAD option is in effect, the following items are not supported. If encountered, they are diagnosed as errors:
Additionally, some language constructs have different semantics than in the nonthreaded case.
Although threaded applications are subject to a number of programming and environment restrictions, the use of a program in nonthreaded applications is not so restricted. For example, a program compiled with the THREAD option can run in the CICS and IMS environments, can run AMODE 24, and can call and be called by other programs that are not enabled for multithreading, provided that the application does not contain multiple POSIX threads or PL/I tasks at run time.
Programs compiled with the THREAD option are supported in a reusable environment that is created by calling the Language Environment preinitialization routine CEEPIPI. But a reusable environment created by calling IGZERRE or ILBOSTP0 or by using the RTEREUS runtime option is not supported for programs compiled with the THREAD option.
Performance consideration: When using the THREAD option, you can expect some runtime performance degradation due to the overhead of serialization logic that is automatically generated.
related tasks
Preparing COBOL programs for multithreading
related references
Conflicting compiler options