Sharing Files and Locking Records
8.3 Ensuring Successful File Sharing
Example 8–1 (Cont.) X/Open Standard Lock Modes and Opening Files
PROCEDURE-DIVISION.
BEGIN.
* The file is shareable per LOCK MODE specification:
OPEN I-O employee-file.
* The file is exclusive during this access stream, overriding the
* LOCK MODE specification:
OPEN I-O master-file WITH LOCK.
* The file is exclusive per LOCK MODE; others cannot access it:
OPEN INPUT tran-file.
* The file defaults to exclusive; others cannot access it:
OPEN EXTEND job-codes.
8.3.5 Specifying File Access Using Compaq Standard File Sharing
Compaq standard file sharing is summarized in this section and fully described
in the Compaq COBOL Reference Manual (Environment Division and Procedure
Division chapters).
You use the ALLOWING clause of the OPEN statement to specify what other
access streams are allowed to access that file. The forms of OPEN ALLOWING
are as follows:
•
OPEN ALLOWING NO OTHERS—Locks the file for exclusive access.
Attempts by other access streams to access the file cause a file lock condition.
•
OPEN ALLOWING READERS—Locks the file against operations that
indicate intended write access (OPEN I-O and OPEN EXTEND). Other
streams can use the OPEN INPUT statement to view the file. No updaters
are permitted.
On Tru64 UNIX, this lock is limited for INDEXED files, as follows:
–
Any stream
If automatic record locking was requested, the file has now been
opened with manual record locking in an attempt to process
READERS.
–
First stream
If the open mode was INPUT (reader), subsequent non-exclusive
updaters will get access to the file at OPEN time, but they will not be
able to update the file at the record level.
If the mode is EXTEND, I-O, or OUTPUT (updater), the file lock
acquired will not exclude other updaters that have specified full
sharing of the file (with ALLOWING {ALL,UPDATERS,WRITERS}).
–
Subsequent stream
If the mode is EXTEND or OUTPUT (updater), access to the
file is granted instead of denied when a previous updater
stream has specified full sharing of the file (with ALLOWING
{ALL,UPDATERS,WRITERS}).
8–8 Sharing Files and Locking Records
Содержание COBOL AAQ2G1FTK
Страница 22: ......
Страница 30: ......
Страница 94: ......
Страница 110: ......
Страница 146: ......
Страница 180: ......
Страница 194: ...Processing Files and Records 6 1 Defi...
Страница 300: ......
Страница 490: ......
Страница 516: ......
Страница 517: ......
Страница 530: ......
Страница 534: ......
Страница 590: ......
Страница 620: ......