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

FREE statement for based variables

The FREE statement frees the storage allocated for based and controlled variables.

Read syntax diagramSkip visual syntax diagram         .-,----------.
         V            |
>>-FREE----| option |-+--;--| option: |------------------------->
 
>--+-----------------------+--based-variable-------------------->
   '-locator-reference -> -'
 
>--+-------------------+---------------------------------------><
   '-IN(area-variable)-'
 
locator-reference ->
Frees a particular generation of a based variable. The composite symbol -> means "qualified by" or "points to." If the based variable is not explicitly locator-qualified, the locator variable declared in the BASED attribute is used to identify the generation of data to be freed. If no locator has been declared, the statement is in error.
based variable
Must be a level-1 unsubscripted based variable.
IN
Must be specified or the based variable must be qualified by an offset declared with an associated area, if the storage to be freed was allocated in an area. The IN option cannot appear if the based variable was not allocated in an area. Area assignment allocates based storage in the target area. These allocations can be freed by the IN option naming the target area.

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

A based variable can be used to free storage only if that storage has been allocated for a based variable having identical data attributes.

The amount of storage freed depends upon the attributes of the based variable, including bounds and/or lengths at the time the storage is freed. The user is responsible for determining that this amount coincides with the amount allocated. If the variable has not been allocated, the results are unpredictable.

Implicit freeing

A based variable need not be explicitly freed by a FREE statement, but it is a good practice to do so.

All based storage is freed at the termination of the program.


Terms of use | Feedback

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