Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

ALLOCATE statement for based variables

The ALLOCATE statement allocates storage for based variables and sets a locator variable that can be used to identify the location, independent of procedure block boundaries.

Read syntax diagramSkip visual syntax diagram             .-,------------------------------------------.
             V                                            |
>>-ALLOCATE----based-variable--+------------------------+-+----->
                               '-| location-reference |-'
 
>--;--| location-reference: |--+-------------------+------------>
                               '-IN(area-variable)-'
 
>--+-----------------------+-----------------------------------><
   '-SET(locator-variable)-'
 

Abbreviation: ALLOC

based variable
Is a level-1 unsubscripted variable.
IN

Specifies the area variable in which the storage is allocated. For more information on areas, refer to Area data and attribute.
SET

Specifies a locator variable that is set to the location of the storage allocated. If the SET option is not specified, the locator used is the one specified in the declaration of the based variable. For syntax information about declaring based variables, refer to Based storage and attribute and Locator data.

Both based and controlled variables can be allocated in the same statement. For the syntax of controlled variables, see ALLOCATE statement for controlled variables.

Storage is allocated in an area when the IN option is specified or the SET option specifies an offset variable. These options can appear in any order. For allocations in areas:

When an area is not used, the locator variable must be a pointer variable. If storage for the based variable is not available, the STORAGE condition is raised.

Note that if a based variable uses REFER, it size will be calculated at run-time. If this calculation yields a value that is too large to fit in a FIXED BIN(31) variable, then your program is in error and should be corrected. In this situation, the STORAGE condition will not be raised; instead the ERROR condition with ONCODE=3809 will be raised if:

If neither of these conditions apply, unpredictable results will occur.

The amount of storage allocated for a based variable depends on its attributes, and on its dimensions, length, or size specifications if these are applicable at the time of allocation. These attributes are determined from the declaration of the based variable.

A based structure or union can contain adjustable array bounds or string lengths or area sizes (see REFER option (self-defining data)). The asterisk notation for extents is not allowed for based variables.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)