DATA Step, Macro, Functions and more

A lock is not available for dataset

Reply
Super Contributor
Posts: 271

A lock is not available for dataset

I am constantly getting this error "A lock is not available for dataset" when data set is writing or some body has opened the data set. I wonder if there is an effective solution to overcome this or to know if the data set is in use.

 

Thanks !

PROC Star
Posts: 1,760

Re: A lock is not available for dataset

[ Edited ]
Posted in reply to SAS_inquisitive

One way to test the availibilty of a dataset is to try opening it. For example:

 

data _null_;
 DSID=open('work.table');
 if DSID then putlog 'Unlocked';
 else         putlog 'Locked';
 RC=close(DSID);
run;

 

If you need access while writes are taking place, SAS/SHARE might be your answer.

It allows just this.

 

 

Super User
Posts: 5,427

Re: A lock is not available for dataset

Posted in reply to SAS_inquisitive

Please describe your environment.

What kind of data, and access patterns to the data do you have?

What kind of updates do you do, frequency?

Data volumes etc.

Data never sleeps
Super Contributor
Posts: 271

Re: A lock is not available for dataset

[ Edited ]

@LinusH  Windows environment. This is related to financial data such customer information, transactions etc.  The programs are scheduled to run daily, hence, they are updated daily. Some programs also create historical data (appending today's data to yesterday;s).  Data records are in hundred of millions.  When I am creating some ad hoc report using the permanent data set that is currently being written by the program, I get this error. I suppose I have to wait until it finished buliding the data set.

Super User
Posts: 5,427

Re: A lock is not available for dataset

Posted in reply to SAS_inquisitive
Quite large environment I guess.
If you haven't already done so, separate the historical complete data from the user access data (aka data marts).
Still, you need to consider locking problems in the user access area. What kind of clients do you use? If you can limit access through the server, there are some actions that can throw out user that is locking the table.
Another option is to consider another storage engine. With the volumes you are describing SAS/SHARE may not be feasible. SAS/SPD Server has a more intelligent and much more efficient way to handle concurrent access.
Data never sleeps
Ask a Question
Discussion stats
  • 4 replies
  • 1972 views
  • 2 likes
  • 3 in conversation