Storage control built-in functions

The storage control built-in functions allow you to determine the storage requirements and location of variables, to assign special values to area and locator variables, to perform conversion between offset and pointer values, to obtain the number of generations of a controlled variable, and to reference data and methods of objects and classes.

Table 1 lists the storage control built-in functions.

Table 1. Storage control built-in functions

Function

Description

ADDR

Returns the address of a variable

ADDRDATA

Returns the address of the first data byte of a string when applied to a varying string

ALLOC31

Allocates storage of the specified size in below-the-bar heap

ALLOCATE

Allocates storage of the specified size in the heap

ALLOCATION

Returns the current number of generations of a controlled variable

ALLOCNEXT

Allocates storage of the specified size in an AREA if there is enough space in the first available chunk

ALLOCSIZE

Returns a FIXED BIN(N,0) value giving the amount of storage allocated with a specific pointer

AUTOMATIC

Allocates storage of the specified size in the stack

AVAILABLEAREA

Returns the size of the largest single allocation that can be made in an area

BINARYVALUE

Converts a pointer, offset, or ordinal to an integer

BITLOCATION

Returns the bit offset of a variable within a byte

CHECKSTG

Returns a bit(1) value determining whether allocated storage is uncorrupted

CURRENTSIZE

Returns the current size of a variable

CURRENTSTORAGE

Synonym for CURRENTSIZE

EMPTY

Returns an "empty" area

ENTRYADDR

Returns the address of the routine associated with an entry

HANDLE

Returns a handle to a typed structure or union

LOCATION

Returns the byte offset of a variable within a structure
LOCSTG Returns the number of bytes needed to hold all the allocated storage that is needed to hold all the values that can be held indirectly by using LOCATES.
LOCVAL Returns the value at the offset that is specified in an area with the type specified in the LOCATES description

NULL

Returns a null pointer value

NULLENTRY

Returns a limited entry value with a null value

OFFSET

Converts a pointer to an offset

OFFSETADD

Adds an integer to an offset

OFFSETDIFF

Subtracts two offsets

OFFSETSUBTRACT

Subtracts an integer from an offset

OFFSETVALUE

Converts an integer to an offset

POINTER

Converts an offset to a pointer

POINTERADD

Adds an integer to a pointer

POINTERDIFF

Subtracts two pointers

POINTERSUBTRACT

Subtracts an integer from a pointer

POINTERVALUE

Converts an integer or handle to a pointer

SIZE

Returns the maximum size of a variable

STORAGE

Synonym for SIZE

SYSNULL

Returns a system null pointer value

TYPE

Returns the typed structure or union located by a handle

UNALLOCATED

Returns a bit(1) value indicating if a specified pointer value is the start of allocated storage

VARGLIST

Returns the address of the first optional parameter passed to a procedure

VARGSIZE

Returns the number of bytes occupied by a byvalue parameter





Published: 23 December 2018