CBL_ALLOC_SHMEM

Dynamically allocates shared memory.

Syntax:

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

Parameters:

  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

or

pic x(8) comp-5 (64-bit native programs only)

flags cblt-os-flags pic x(4) comp-5
status-code See Library Routines - Key  

On Entry:

mem-size
The number of bytes of memory to allocate.
flags
Must be set to zero.

On Exit:

mem-pointer
A pointer to the memory allocated. The allocated memory is not initialized.
status-code
0 Successful allocation
157 Unable to allocate memory

Comments:

The maximum total size of shared memory that you can dynamically allocate is determined by the value of the shared_memory_segment_size run-time tunable (or its default value, if not explicitly set).

The memory allocated is not initialized to any value.

Updates to any shared memory allocated to this function are not serialized or protected by the run-time system; you should use semaphores to maintain the integrity of the data.

This routine cannot be used within a sub-program that is compiled with the AMODE directive in effect.