GETMAIN Function

#### Search Results

Search

# GETMAIN Function

The GETMAIN function is used to acquire storage from the thread in which the application is running. This storage can be used for any function desired by the program.

The amount of storage requested is acquired only if that amount of storage is available within the thread as a contiguous segment. Note that there is no protection from storage overruns within the thread.

When a request is made, the largest contiguous segment available that is greater than or equal to the minimum and less than or equal to the maximum will be returned.

Note that requested lengths must be in double word segments, or Com-plete will round up length requests to double word multiples. This action on the part of Com-plete is consistent with that of the FREEMAIN function as well, and prevents storage fragmentation to some degree.

> Format

>   The format for using the GETMAIN function is:

>       GETMAIN (retcode,minmax,addrlen)

>   retcode | Required. Specifies a fullword where Com-plete places the return code upon completion of the operation.
>   minmax | Required. Specifies the address of two binary fullwords. The first of these words contains the minimum amount of storage that will satisfy the request. The second specifies the maximum amount of storage needed by the request.
>   addrlen | Required. Specifies the address of two binary fullwords. The address of the acquired storage is placed into the first word. The length of the acquired storage is placed into the second word.

> Return Codes

>   The following return codes are issued by the GETMAIN function:

>   0 | No errors.
>   4 | The requested space was not available.
>   12 | An invalid request or an invalid FQE was found.

> Abends

>   There are no abends associated with the GETMAIN function.