The sharing mode indicates whether a file is to participate in file sharing and record locking.
Three sharing modes are available:
Sharing Mode | Description |
---|---|
SHARING WITH NO OTHER | Do not allow sharing with any other user of this file |
SHARING WITH READ ONLY | Allow sharing with other users who have the file opened for input |
SHARING WITH ALL OTHER | Allow sharing with all other users |
For a full table showing the results when an OPEN is attempted in the various sharing modes, see the table Opening available shared files that are currently open by another file connector in the topic The OPEN Statement.
To specify one of these sharing modes, use the SHARING phrase either on an OPEN statement or as part of the SELECT clause. The SHARING phrase in the OPEN statement overrides that in the SELECT clause.
If you do not include the SHARING phrase in either the SELECT clause or the OPEN statement, the sharing mode is determined when the first of the following conditions is satisfied:
If You Specify ... | Sharing Mode |
---|---|
The WITH LOCK phrase on the OPEN statement | SHARING WITH NO OTHER |
The LOCK MODE IS EXCLUSIVE phrase in the SELECT clause | SHARING WITH NO OTHER |
Either the LOCK MODE IS MANUAL phrase or the LOCK MODE IS AUTOMATIC phrase in the SELECT clause | SHARING WITH ALL OTHER |
The open mode as OUTPUT, I-O or EXTEND | SHARING WITH NO OTHER |
The open mode as INPUT and the configuration option OPENINPUTSHARED set to OFF | SHARING WITH READ ONLY |
The open mode as INPUT and the configuration option OPENINPUTSHARED set to ON | SHARING WITH ALL OTHER |