Free STATEMENT

PURPOSE:  The FREE statement releases all records in one or more DS's that were locked by a previous GET statement.  This is only used when developing applications where multiple users will access the data simultaneously.  The designated data set must have been related using the ALLOWING clause ( see RELATE statement ).  The execution of this statement sets values into @AUX which, whether the execution was successful or not, should be examined by the program.

SYNTAX

FREE [designator] ALL

designator

is the name assigned the DS containing the locked records.  If a designator is specified, the FREE statement frees all records in that DS.  If no designator is specified, the FREE statement frees all records that have been locked in previous GET statement.

Example

GET FROM BOOKS_DBM2 LOCKED NEXT RECORD
.
.
.
FREE BOOKS_DBM2 ALL

NOTES:  Locked records are automatically freed when a record from another block is read, unless the MULTIPLE option is used in the GET LOCKED statement.  In that case, a FREE statement must be used to free the locked records so that other concurrent users may access them.  Records are also unlocked if a PUT or DELETE are executed on the DS.

All records are automatically freed when the PM is terminated.

The FREE statement is only valid when the PM is executed under the simultaneous access environment.

SEE ALSO:  Simultaneous Update chapter.