Specifies whether to read a record if a lock cannot be obtained for the
record
| Language element: |
data set option
|
| Default: |
NO
|
| Engines: |
CONCUR
|
| Valid as: |
data set option
|
| OpenVMS specifics: |
All aspects are host-specific
|
-
YES
-
indicates that the record must be locked when read. If another process already has the record locked, the read operation fails, and you receive a message that the
record is locked by another process.
-
NO
-
indicates that records do not have to be locked when they are read. If another process already has the record locked, the data are read but are not locked by the
reading process.
The LOCKREAD= data set option controls whether SAS reads a record when the record is locked by another process. This option
applies only to data sets that are accessed for input. Examples of accessing a data set for input include using the SET statement and the PRINT and FSBROWSE
procedures. This data set option does not apply when you are using, for example, the FSEDIT procedure, which accesses a data set for
update.
If you specify LOCKREAD=YES and your job tries to access a locked record, the read operation fails. The severity of the
failure depends on your job. If you are using FSBROWSE, and you try to move to a locked observation, a message displays saying the observation is unavailable.
However, you can still move to other observations that are not locked. A more severe failure occurs if you are using a SET statement in
the DATA step. If the DATA step encounters a locked record, the DATA step fails,
and your data set will probably be incomplete.
- CAUTION:
- Use LOCKREAD=NO with care.
When you specify
LOCKREAD=NO, the SAS System reads locked records. This can result in obsolete data being read. If you know that the data that you are reading are changing often,
do not use LOCKREAD=NO.
![[cautend]](../common/images/cautend.gif)
LOCKREAD= is closely related to the LOCKWAIT= data set
option, which controls whether SAS waits for a locked record to become
available.
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.