BookmarkSubscribeRSS Feed
SaugataM
Fluorite | Level 6
Hi,
I am getting an intermittent error of "A lock is not available on Work.XXXXX". The dataset name changes and not always I get this error. But invariably once or twice a day I will get this problem and it is always on the datasets of Work library.
I have already opened a communication with the server infra team to check whether any 3rd party tool is accessing these files (like backup, scan etc.).

I have also checked the options like FILELOCKWAIT to make sure that instead of failing instantaneously, the system waits for some time to get the lock. But since I am using SAS 9.3; the FILELOCKWAIT system option is not available to me and the LIBNAME option does not work for WORK library.

I am looking for:
1) Either a way to identify the process that is creating this lock in Windows environment.
2) Or, a feasible way (since it can be any of the work dataset, using a trylock type macro for all the datasets is very difficult to implement) to make the system wait for n seconds before throwing the error.

Thanks a lot for your time.
4 REPLIES 4
yabwon
Amethyst | Level 16

Hi @SaugataM ,

 

did you test the LOCK statement:

 

https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.4&docsetId=lestmtsglobal&docsetTarge...

 

?

 

All the best

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



r_behata
Barite | Level 11

Here is a use case for the Lock statement.

 

http://support.sas.com/kb/51/275.html

 

Use the %trylock macro in a conflicting process  which waits for the other process till either it releases the lock on the dataset or until a configurable time period.

 

Here is the command to unlock the dataset once the processing is done since the macro explicitly locks the dataset, it is safe to clear the lock once the processing is done.

lock rcli_.rcli_control_master clear;

 

SaugataM
Fluorite | Level 6

Thanks a lot for your reply.

 

Since I have hundreds of datasets getting created in the work library. Encasing all of them in a trylock macro in an already deployed product is going to be very tough, if not impossible.

 

That is why I am looking for a system or library wise option.

SASKiwi
PROC Star

Please confirm with your server team that this drive is NOT being backed up and hence there should be no third-party tools locking files. There is absolutely no need to backup SAS work drives.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1943 views
  • 0 likes
  • 4 in conversation