Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A <lock-statement> restricts which parts of a file can be accessed by external agents. When used without a <record-range>, it prevents external agents from accessing any part of the file.
-
lock-statement = "Lock" file-number [ "," record-range] record-range = start-record-number / ([start-record-number] "To" end-record-number) start-record-number = expression end-record-number = expression
Static Semantics:
§ The declared type (section 2.2) of <start-record-number> and of <end-record-number> MUST be a scalar declared type (section 2.2).
§ If there is no <start-record-number> the effect is as if <start-record-number> consisted of the integer number token 1.
Runtime Semantics.
§ An error (number 52, "Bad file name or number") is raised if the file number value (section 5.4.5.1.1) of <file-number> is not a currently-open (section 5.4.5.1) file number (section 5.4.5).
§ If no <record-range> is present the entire file is locked.
§ If the file number value was opened with <mode> Input, Output, or Append, the effect is as if no <record-range> was present and the entire file is locked.
§ The start record is the evaluated value of <start-record-number> Let-coerced to declared type Long.
§ The end record is the evaluated value of <end-record-number> Let-coerced to declared type Long.
§ Start record MUST be greater than or equal to 1, and less than or equal to end record. If not, an error is raised.
§ If the file number value was opened with <mode> Random, start record and end record define a inclusive span of records within the external data file associated with that file number value. In this case, each record in the span is designated as locked.
§ If the file number value was opened with <mode> Binary, both <start-record-number> and <end-record-number> define a byte-position within the external data file associated with that file number. In this case, all external file bytes in the range start record to end record (inclusive), are designated as locked.
-
-
Locked files or locked records or bytes within a file might not be accessed by other external agents. The mechanism for actually implementing such locks and whether or not a lock can be applied to any specific external file is implementation defined.
-
§ Multiple lock ranges established by multiple lock statements can be simultaneously active for an external data file. A lock remains in effect until it is removed by an <unlock-statement> that specifies the same file number as the <lock-statement> that established the lock and which either unlocks the entire file or specifies an <record-range> evaluates to the same start record and end record. A <close-statement> remove all locks currently established for its file number value.