Previous Page | Next Page

SAS Component Language Dictionary

LOCK



Locks or unlocks a SAS table or a SAS catalog entry
Category: SAS Table

Syntax
Details
Example

Syntax

sysrc=LOCK(member<,action>);

sysrc

contains the return code for the operation:

0

successful

>0

not successful

<0

the operation was completed, but a warning or a note was generated.

member

is a member of a SAS data library or a SAS catalog entry. The value that you specify can be a one-, two-, three-, or four-level name. A one-level name is presumed to be a libref, whereas a two-level name defaults to the SAS table type DATA.

Type: Character

action

specifies an action to be performed on the SAS table or catalog entry:

'CLEAR'

unlocks the specified SAS table(s) or SAS catalog entry.

'LOCK'

locks the specified SAS table(s) or SAS catalog entry. (This is the default.)

'QUERY'

queries the lock status of a SAS table or a SAS catalog entry.

_SWNOLKH

not currently locked. SYSRC of -630099.

_SWLKUSR

locked by another user. SYSRC of -630097.

_SWLKYOU

locked or in use by the caller. SYSRC of -630098.

Type: Character


Details

If action is not provided, the action defaults to LOCK.


Example

Lock the data library that is associated with a libref of A, unlock data view LIB.A, and lock LIB.A.B.PROGRAM. Then, query the lock state of the FOO.ONE table:

rc=lock('a');
rc=lock('lib.a.view','clear');
rc=lock('lib.a.b.program');
rc=lock('foo.one.data','query');
if (rc=%sysrc(_SWLKUSR)) then
  _msg_='Table foo.one is currently locked.';

Previous Page | Next Page | Top of Page