Threads considerations for ILE COBOL language

An Integrated Language Environment® (ILE) COBOL module that runs safely in a multithreaded environment can be created by serializing access to the module.

You can serialize access to the ILE COBOL module by specifying THREAD (*SERIALIZE) on the PROCESS statement. After you serialize the module, only one thread can run any procedure in that module at one time. For example, consider a module that has procedures P1 and P2. If one thread is running procedure P1, no other thread can run either procedure P1 or P2 until the first thread finishes running P1.

Even when a module is serialized, the COBOL programmer must ensure that global storage and heap storage are accessed in a threadsafe way. Even if a COBOL procedure apparently uses only automatic storage, COBOL uses static storage control blocks in every procedure. Therefore, you must always specify THREAD (*SERIALIZE) when using ILE COBOL in a multithreaded environment.