FREE (for TEXT/BYTE)
The FREE
statement releases resources
allocated to the specified variable.
Syntax
FREE target
- target is the name of a
TEXT
orBYTE
variable to be freed.
Usage
When followed by a variable name, the FREE
statement releases resources
allocated to store the data of TEXT
and BYTE
variables.
If the TEXT
/BYTE
variable
was located in memory, the runtime system releases the memory.
If the variable was located in a file, the runtime system
deletes the file.
For variables declared in a local scope of reference, the resources are automatically freed by
the runtime system when returning from the function or MAIN
block.
After freeing a TEXT
or BYTE
variable, it must be
re-configured with a new LOCATE
call.
Temporary files of large object are automatically deleted when the program ends.
Example
MAIN
DEFINE ctext TEXT
DATABASE stock
LOCATE ctext IN FILE "/tmp/data1.txt"
SELECT col1 INTO ctext FROM lobtab WHERE key=123
FREE ctext
END MAIN