THREAD

THREAD controls whether programs are to be enabled for use in multithreaded applications.

Syntax

Read syntax diagramSkip visual syntax diagramTHREAD=*NOYES
Default
THREAD=NO
YES
Use YES to indicate that programs are to be enabled for execution in Language Environment® enclaves that have multiple POSIX threads or PL/I tasks.
NO
Use NO to indicate that programs are not to be enabled for execution in Language Environment enclaves that have multiple POSIX threads or PL/I tasks.

Performance consideration: If the THREAD compiler option is specified, runtime performance might be degraded because of the serialization logic that is automatically generated.

Note:
  • The THREAD compiler option is ignored when LP(64) is in effect. If the user explicitly specifies the THREAD option, an informational message is issued.
  • If the THREAD compiler option is specified, the program is enabled for use in a threaded application. However, THREAD can be used in nonthreaded applications. For example, you can run a program that was compiled with the THREAD option in the CICS® environment if the application does not contain multiple POSIX threads or PL/I tasks at run time.
  • If the THREAD compiler option is specified, the RENT compiler option must also be specified. If THREAD and NORENT are specified at the same level of precedence, RENT is forced on.
  • For COBOL programs to run in a threaded application, all COBOL programs in the run unit must be compiled with the THREAD compiler option.
  • If the THREAD compiler option is specified, the following language elements are not supported. If any of the following language elements are specified, they are diagnosed as errors:
    • ALTER statement
    • DEBUG-ITEM special register
    • GO TO statement without a procedure name
    • INITIAL phrase in the PROGRAM-ID paragraph
    • Nested programs
    • RERUN
    • Segmentation module
    • MERGE or Format 1 SORT statements
    • STOP literal statement
    • USE FOR DEBUGGING statement
  • If you compile programs with the THREAD compiler option, the following special registers are allocated upon each invocation:
    • ADDRESS OF
    • JSON-CODE
    • JSON-STATUS
    • RETURN-CODE
    • SORT-CONTROL
    • SORT-CORE-SIZE
    • SORT-FILE-SIZE
    • SORT-MESSAGE
    • SORT-MODE-SIZE
    • SORT-RETURN
    • TALLY
    • XML-CODE
    • XML-EVENT
    • XML-INFORMATION
    • XML-NAMESPACE
    • XML-NAMESPACE-PREFIX
    • XML-NNAMESPACE
    • XML-NNAMESPACE-PREFIX
    • XML-NTEXT
    • XML-TEXT