Locking Records (EXTRACT)

The EXTRACT command may be used in place of a READ to keep PRO/5 from advancing the file pointer. The EXTRACT command also locks the extracted record to keep other users from reading the record. This is necessary in a multi-user situation where many users may be attempting access the same set of records. Failure to EXTRACT the record in this situation may cause your program to misbehave in a particularly nasty manner.

It does not significantly increase the record access time to use EXTRACT; it even improves some accessing.

You may tell PRO/5 that an EXTRACT is to only block other EXTRACT operations and REMOVE operations, and another user may READ the data EXTRACTED by you. This mode of operation is called 'advisory locking' and may be enabled using the SETOPTS command.

Note that only records that have data can be locked. EXTRACTing a record that has just a key and no data (records in Sort files and records in Direct and Mkeyed files that have a record length set to zero) will not cause the record to be locked. The structure of the key chain makes it possible to lock just one key, so locking must occur on the data portion of the record.