Sharing Files and Locking Records
8.4 Ensuring Successful Record Locking
Example 8–7 (Cont.) Program Segment for Record-Locking Exceptions
END DECLARATIVES.
MAIN-BODY SECTION.
BEGIN.
DISPLAY "From main-body".
.
.
.
GET-RECORD.
READ file-name.
IF NOT record-ok
.
.
.
CHECK-READ.
IF record-locked
END-IF.
* handle other possible errors here
RETRY-READ.
READ file-name.
add 1 to retry-count.
8–26 Sharing Files and Locking Records
IF record-locked
continue
ELSE
.
.
.
END-IF.
PERFORM check-read.
MOVE 1 to retry-count
PERFORM retry-read UNTIL record-ok OR
IF record-locked AND retry-count > max-retry
DISPLAY "Record is unavailable...enter new record to retrieve: "
WITH NO ADVANCING
ACCEPT record-id
GO TO get-record
END-IF
retry-count > max-retry
Need help?
Do you have a question about the COBOL AAQ2G1FTK and is the answer not in the manual?