Sharing Files and Locking Records
8.1 Controlling Access to Files and Records
WRITE
REWRITE
DELETE
UNLOCK
8.2 Choosing X/Open Standard or Compaq Standard File Sharing
and Record Locking
Compaq COBOL offers two methods of controlling potential conflicts of multi-user
file access between simultaneously running processes:
•
Compaq standard, which is compatible with Compaq COBOL for OpenVMS
VAX behavior
1
•
X/Open standard, which conforms to the X/Open CAE Specification: COBOL
Language and which offers X/Open portability
Both effectively control potential conflicts of file access between simultaneously
running COBOL processes. Both offer locking for all file types: sequential,
relative, and indexed.
Note
If you choose X/Open standard file sharing and record locking for a file
connector, you must not use Compaq standard syntax anywhere in your
program for the same file connector. The two are mutually exclusive.
The Compaq COBOL compiler determines whether to apply X/Open standard
behavior or Compaq standard behavior for any file connector on the basis of
the syntax used for that file connector. The following syntax identifies X/Open
standard:
LOCK MODE (SELECT statement)
WITH LOCK (OPEN statement)
WITH [NO] LOCK (READ statement)
UNLOCK RECORDS
The following syntax identifies Compaq standard:
APPLY LOCK-HOLDING (Environment Division)
ALLOWING
1
REGARDLESS
1
(Procedure Division)
UNLOCK ALL
For any given file connector, any subsequent I-O locking syntax in your program
must be consistent: X/Open standard and Compaq standard file sharing/record
locking (implicit or explicit) cannot be mixed for the same file connector.
If a program includes any ambiguous semantics for I-O verbs (that is, no locking
syntax for verbs for which the two standards provide different default behavior)
and the previous code does not use Compaq or X/Open standard-specific syntax
for that file connector, the compiler determines which standard to use by applying
the specification (or default) from your compile command line, as follows:
•
The
-std [no]xopen
flag on the
cobol
command for the Tru64 UNIX
operating system
1
Some exceptions exist on Windows NT and Tru64 UNIX. See Compaq COBOL Reference
Manual for details.
Sharing Files and Locking Records 8–3
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......