![]() Locking Sets of Auto-Sequenced Records |
![]() Virtual Machine |
![]() |
Locking Sets of Auto-Sequenced Records
Since the system performs automatic updating of Enforced Paging Files, some method to control concurrent access to such files is necessary to prevent corruption of the sequence numbers by competing processes. PROIV uses a record lock on sequence number zero, which is assumed never to exist, to prevent multiple concurrent accesses to a sequence. This action is only performed on files whose Enforced Paging flag is set.
Sequence zero is locked at the following points in time:
-
After entering a Paging screen for the first time, and before displaying the first page of data for the Paging screen, sequence zero is locked for the primary file.
-
After the Before Read logic for a file, but before the actual read.
-
After entering a Paging report or Update but before doing the sort pass, sequence zero is locked for the primary file.
Sequence zero is unlocked:
-
After a secondary file is read, if a DSEL is issued in After Read logic, and if its sequence zero is locked.
-
Immediately before exiting a Paging report or Update.
-
Immediately after writing a file. If the file is deselected, it is not written but its sequence zero is still unlocked.
-
Immediately after exiting a Paging screen.
![]() |
Because of limitations in the underlying file services, Enforced Paging Files are treated as two open files instead of one. This phenomenon, combined with the system-dependent limit on the number of simultaneous open files, may impact some applications. |
In general, the sequence zero lock for a primary Enforced Paging File in a paging logical block, is locked immediately upon entering the logical block and unlocked upon exiting the logical block. It remains locked during all iterations of the logical block. For secondary Enforced Paging Files and primary Enforced Paging Files in non-paging logical blocks, the sequence zero lock is locked immediately before reading the file and unlocked immediately after writing the file (or after the Before Write logic if the file has been deselected).
Auto-Sequence Number
This is a one-to-five digit number with limit 32,767; that is appended to the end of the keys of records in an auto-sequenced file. The auto-sequence number has a user defined field name and must be defined as the last key variable in the record layout.
In an auto-sequenced paging screen that uses an auto-sequenced file, special provision is made for insertion or deletion of records so that the auto-sequenced field is re-numbered to maintain continuity.
For example auto-sequenced files might be used for invoice detail lines, the key being the invoice number and the auto-sequence number supplying the detail line numbers. Detail lines may be added, inserted, or deleted and line numbers will remain consecutive.
Topic ID: 720136