THREAD

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

Read syntax diagramSkip visual syntax diagramNOTHREADTHREAD

Default is: NOTHREAD

Abbreviations are: None

A program that has been compiled using 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 using 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 that are compiled using compilers earlier than Enterprise COBOL are treated as if compiled using NOTHREAD.

If the THREAD option is in effect, the following elements are not supported. If encountered, they are diagnosed as errors:

  • ALTER statement
  • DEBUG-ITEM special register
  • GO TO statement without procedure-name
  • INITIAL phrase in PROGRAM-ID clause or INITIAL compiler option
  • Nested programs
  • RERUN
  • Segmentation module
  • SORT or MERGE statements
  • STOP literal statement
  • USE FOR DEBUGGING statement

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 using 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 using the THREAD option are supported in the reusable environment that is created by calling the Language Environment preinitialization routine CEEPIPI. But a reusable environment created by using the RTEREUS runtime option is not supported for programs compiled using the THREAD option.

Performance consideration: If you use the THREAD option, you can expect some runtime performance degradation due to the overhead of serialization logic that is automatically generated.

AMODE 64 considerations: The THREAD option is ignored when LP(64) is in effect. If the user explicitly specifies the THREAD option, an informational message is issued.

Related references  
Conflicting compiler options