Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

FREE statement

Function

The FREE statement releases storage which was requested beforehand with an ALLOCATE statement (see ALLOCATE statement ).

Format


FREE {data-name-1}...


Syntax rule

  1. data-name-1 must be of the category "data pointer".

General rules

The FREE statement is executed as follows:

  1. If the data pointer data-name-1 points to the start of the storage which was requested beforehand with the ALLOCATE statement, this storage is released and the data pointer data-name-1 is set to NULL. The length of the released storage is the same as that which was requested with ALLOCATE. The content of any data item within the released storage area is undefined.

  2. If the data pointer data-name-1 contains the predefined address NULL, no storage is released.

  3. In all other cases the exception condition EC-STORAGE-NOT-ALLOC occurs. data-name-1 is not modified. If the check for EC-STORAGE-NOT-ALLOC is activated, the associated exception condition is triggered and the corresponding USE procedure is branched to if it is available. If the check of the exception condition is not activated or if the USE procedure is executed with RESUME AT NEXT STATEMENT, the program run is continued in accordance with rule 4.

    The FREE statement can lead to a crash if the check of the exception condition EC-STORAGE-NOT-ALLOC is deactivated.

  4. If more than one data-name-1 is specified, this applies as if a separate FREE statement had been specified for each data-name-1 in the specified order. If the exception condition EC-STORAGE-NOT-ALLOC occurs as a result of one of these implicit FREE statements, the program run (as required after a return from the relevant USE procedure) is continued with the next implicit FREE statement, if there is one.