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

Area assignment

The value of an area reference can be assigned to one or more area variables by an assignment statement. Area-to-area assignment has the effect of freeing all allocations in the target area and then assigning the extent of the source area to the target area, so that all offsets for the source area are valid for the target area.

In the following example:

  declare X based (O(1)),
          O(2) offset (A),
          (A,B) area;

          alloc X in (A);
          X = 1;
          alloc X in (A) set (O(2));
          O(2) -> X = 2;
          B = A;

Using the POINTER built-in function, the references POINTER (O(2),B)->X and O(2)->X represent the same value allocated in areas B and A, respectively.

If an area containing no allocations is assigned to a target area, the effect is to free all allocations in the target area.

Area assignment can be used to expand a list of based variables beyond the bounds of the original area. Attempting to allocate a based variable within an area that contains insufficient free storage to accommodate it, or attempting to assign an area to another area that is not large enough raises the AREA condition. The ON-unit for this condition can be used to change the value of a pointer qualifying the reference to the inadequate area, so that it points to a different area; on return from the ON-unit, the allocation is attempted again, within the new area. Alternatively, you can use the AVAILABLEAREA built-in function to determine whether the allocation you are about to make can be done in the area without raising the AREA condition. Also, the ON-unit can write out the area and reset it to EMPTY.


Terms of use | Feedback

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