SAS Component Language Dictionary |
Releases a lock on the current row
-
sysrc
-
contains the return code for the operation:
0 |
successful |
0 |
not successful |
Type:
Numeric
-
table-id
-
is the identifier that was assigned when
the table was opened. If table-id is invalid,
the program halts.
Type: Numeric
A table that is opened in UPDATE mode receives RECORD-level
locking by default. Whenever an application reads a row from a table that
was opened in UPDATE mode, it attempts to obtain a lock on the row. All of
the following functions lock a row when the table is opened in UPDATE mode:
DATALISTC |
DATALISTN |
FETCH |
FETCHOBS |
LOCATEC |
LOCATEN |
Row
locks are implicitly released when a different row
is read. However, when a user is finished with a row but has not read another
row, you can use UNLOCK to explicitly release a lock on the row.
This function is useful when rows from a secondary SAS
table are read to obtain values.
Note: UNLOCK is not
directly related to the LOCK function, which locks SAS catalogs, catalog members,
and SAS tables. However, if the table in question is accessed through SAS/SHARE
software using the REMOTE engine, then UNLOCK can be used to enable other
applications to access individual rows. See
SAS Language Reference: Dictionary for more information. ![[cautionend]](../../../../common/64368/HTML/default/images/cautend.gif)
Call FETCH to read a new row from the SAS table MYDATA,
which is opened in UPDATE mode. After data from the row is processed, call
UNLOCK to release the lock on the row.
dsid=open('mydata','u');
rc=fetch(dsid);
...more SCL statements...
rc=unlock(dsid);
CLOSE
DATALISTC and DATALISTN
FETCH
FETCHOBS
LOCATEC and LOCATEN
OPEN
Copyright © 2011 by SAS Institute Inc., Cary, NC, USA. All rights reserved.