Compaq Standard Record Locking; X/Open Standard Record Locking - Compaq COBOL AAQ2G1FTK User Manual

Compaq computer accessories user manual
Table of Contents

Advertisement

Sharing Files and Locking Records
8.4 Ensuring Successful Record Locking
Example 8–4 X/Open Standard Record Locking
User 1 (Automatic Record Locking):
---------------------------------
FILE-CONTROL.
PROCEDURE DIVISION.
BEGIN.
OPEN I-O FILE-1.
READ FILE-1.
REWRITE FILE-1-REC.
CLOSE FILE-1.
STOP RUN.
User 2 (Manual Record Locking):
------------------------------
FILE-CONTROL
PROCEDURE DIVISION.
BEGIN.
OPEN I-O FILE-1.
READ FILE-1 WITH LOCK.
REWRITE FILE-1-REC.
UNLOCK FILE-1.
CLOSE FILE-1.
STOP RUN.
Note that User 2 could have employed AUTOMATIC record locking just as well.
In this case, manual and automatic locking work similarly.

8.4.2 Compaq Standard Record Locking

Automatic Record Locking (Compaq Standard)
You specify automatic record locking by using the ALLOWING phrase of the
OPEN statement. The lock is applied when you access the record and released
when you deaccess the record. In automatic record locking the access stream can
have only one record locked at a time and can apply only one type of lock to the
records of the file.
8–18 Sharing Files and Locking Records
SELECT FILE-1
ORGANIZATION IS RELATIVE
ASSIGN TO "SHAREDAT.DAT"
LOCK MODE AUTOMATIC.
.
.
.
.
.
.
SELECT FILE-1
ORGANIZATION IS RELATIVE
ASSIGN "SHAREDAT.DAT"
LOCK MODE MANUAL LOCK ON MULTIPLE RECORDS.
.
.
.
.
.
.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?

Questions and answers

Table of Contents