In runtime environments in which more than one run unit can be running concurrently, the possibility arises that one run unit must deny concurrent access to a file or set of files by other run units. This is accomplished through file locking. There are several methods provided in RM/COBOL to specify file locking.
The LOCK MODE clause in the file control entry may specify the EXCLUSIVE phrase. The LOCK MODE IS EXCLUSIVE clause causes each OPEN statement to open the file in exclusive mode.
The EXCLUSIVE phrase may be specified in the OPEN statement.This causes the OPEN statement to open each file in exclusive mode.
The LOCK phrase may be specified for an individual file in the OPEN statement. This causes the OPEN statement to open that file in exclusive mode.
When the LOCK MODE clause is not specified for a file and the OPEN statement does not specify the EXCLUSIVE or WITH LOCK phrases, whether the OPEN statement opens the file in exclusive or shared mode depends on the environment supporting the file and a configurable default.
A file may be opened in the input mode as a shared or exclusive file when the same file is open only in the shared or exclusive input mode by other run units. The exclusive input mode prevents other run units only from concurrent updates of the file, not from concurrent reading of the file.
When an attempt is made
Regardless of lock mode, a file that is open in any mode by another run unit cannot be opened in the output mode.
In shared file environments, opening a file in exclusive mode can improve performance of the other input-output statements executed while the file is open. This is because exclusive mode guarantees that no other run unit will update the file while this run unit has the file open. Therefore, physical records can be locally buffered by the run unit when the file is open in exclusive mode, resulting in lower operating system overhead. For files open in the input-output mode, operating system overhead is further reduced since record locking operations are not necessary.
COBOL Related Interview Questions
|VSAM Interview Questions||IBM - VSAM Interview Questions|
|IBM-CICS Interview Questions||JCL Interview Questions|
|IBM DB2 Interview Questions||IBM-JCL Interview Questions|
|DB2 Using SQL Interview Questions||IBM-JCL&VSAM Interview Questions|
|IBM Mainframe Interview Questions||COBOL, CICS, JCL, VSAM, DB2 Interview Questions|
|DB2 SQL Programming Interview Questions||IMS/DB Interview Questions|
|Mainframe DB2 Interview Questions|
Procedure Division Statements
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.