call "CBL_ALLOC_THREAD_MEM" using      mem-pointer
                            by value  mem-size
                            by value  flags
                            returning status-code


  Using call prototype (see Key) Picture
mem-pointer cblt-pointer usage pointer. Must be level 01.
mem-size cblt-os-size pic x(4) comp-5.
flags cblt-os-flags pic x(4) comp-5.
status-code See Library Routines - Key  

On Entry:

The number of bytes of memory to allocate.
Bits 0-1 Reserved. Must be set to 0.
Bit 2 Allocate this memory independently from any calling program.
Bits 4-31 Reserved. Must be set to 0.

On Exit:

A pointer to the memory allocated. The allocated memory is not initialized.
0 Successful allocation
157 Unable to allocate memory
181 Contradictory flags specification


If bit 2 is not set the memory allocated by CBL_ALLOC_THREAD_MEM is freed when the program that allocated it is canceled (logically or physically), if there is a COBOL program that is directly or indirectly the caller.

If bit 2 is set, this memory is freed when the thread that allocated it terminates, if it has not been previously freed by CBL_FREE_THREAD_MEM.