Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Programming Guide


Preparing COBOL programs for multithreading

You can run COBOL programs in multiple threads within a process under batch, TSO, IMS, or UNIX.

There is no explicit COBOL language to use for multithreaded execution; rather, you compile with the THREAD compiler option.

COBOL does not directly support managing program threads. However, you can run COBOL programs that you compile with the THREAD compiler option in multithreaded application servers, in applications that use a C/C++ driver program to create the threads, in programs that interoperate with Java and use Java threads, and in applications that use PL/I tasking. In other words, other programs can call COBOL programs in such a way that the COBOL programs run in multiple threads within a process or as multiple program invocation instances within a thread. Your threaded application must run within a single Language Environment enclave.

Choosing LOCAL-STORAGE or WORKING-STORAGE: Because you must code your multithreaded programs as recursive, the persistence of data is that of any recursive program:

For the data that you want to isolate to an individual program invocation instance, define the data in the LOCAL-STORAGE SECTION. In general, this choice is appropriate for working data in threaded programs. If you declare data in WORKING-STORAGE and your program changes the contents of the data, you must take one of the following actions:

related concepts  
Multithreading

related references  
THREAD  
PROGRAM-ID paragraph (Enterprise COBOL Language Reference)


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)