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

Area data and attribute

Offset data and attribute
Built-in functions for area variables
Area assignment
Input/output of areas

Area variables describe areas of storage that are reserved for the allocation of based variables. This reserved storage can be allocated to, and freed from, based variables by the ALLOCATE and FREE statements. Area variables can have any storage class and must be aligned.

When a based variable is allocated and an area is not specified, the storage is obtained from wherever it is available. Consequently, allocated based variables can be scattered widely throughout main storage. This is not significant for internal operations because items are readily accessed using the pointers. However, if these allocations are transmitted to a data set, the items have to be collected together. Items allocated within an area variable are already collected and can be transmitted or assigned as a unit while still retaining their separate identities.

You might want to identify the locations of based variables within an area variable relative to the start of the area variable. Offset variables are provided for this purpose.

An area can be assigned or transmitted complete with its contained allocations; thus, a set of based allocations can be treated as one unit for assignment and input/output while each allocation retains its individual identity.

The size of an area is adjustable in the same way as a string length or an array bound and therefore it can be specified by an expression or an asterisk (for a controlled area parameter) or by a REFER option (for a based area).

A variable is given the AREA attribute contextually by its appearance in the OFFSET attribute or an IN option, or by explicit declaration.

Read syntax diagramSkip visual syntax diagram>>-AREA--+-----------------------------------+-----------------><
         +-(*)-------------------------------+
         '-(expression-+-----------------+-)-'
                       '-REFER(variable)-'
 
expression
Specifies the size of the area. If expression, or an asterisk is not specified, the default is 1000.
*
An asterisk can be used to specify the size if the area variable is declared is a parameter.
REFER
For a description of the REFER option, refer to REFER option (self-defining data).

The area size for areas that have the storage classes AUTOMATIC or CONTROLLED is given by an expression whose value specifies the number of reserved bytes.

If an area has the BASED attribute, the area size must be a constant unless the area is a member of a based structure or union and the REFER option is used.

The size for areas of static storage class must be specified as a restricted expression.

Examples of AREA declarations are:

  declare area1 area(2000),
          area2 area;

In addition to the declared size, an extra 16 bytes of control information precedes the reserved size of an area. The 16 bytes contain such details as the amount of storage in use.

The amount of reserved storage that is actually in use is known as the extent of the area. When an area variable is allocated, it is empty, that is, the area extent is zero. The maximum extent is represented by the area size. Based variables can be allocated and freed within an area at any time during execution, thus varying the extent of an area.

When a based variable is freed, the storage it occupied is available for other allocations. A chain of available storage within an area is maintained; the head of the chain is held within the control information. Inevitably, as based variables with different storage requirements are allocated and freed, gaps occur in the area when allocations do not fit available spaces. These gaps are included in the extent of the area.

No operators, including comparison, can be applied to area variables.


Terms of use | Feedback

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