BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Asbon
Obsidian | Level 7

Hi,

 

I'm trying to update my dataset by using update query in data step.

I'm getting error every day at this step. say's locked by someother process.

Added %FILE_LOCKED STATUS macro as well, it checks and gives below error

" NOTE: Following symbolic link, temporary output file is
/path/dataset.sas7bdat.lck
ERROR: A lock is not available for M_M.dataset.DATA.
ERROR: Lock held by process 111111.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: SAS set option OBS=0 and will continue to check statements.

This might cause NOTE: No observations in data set.
NOTE: There were 1 observations read from the data set M_M.dataset.
NOTE: There were 1 observations read from the data set X_X.dataset.
WARNING: The data set M_M.dataset was only partially opened and will not
be saved."

i'm manually running update part every day.

how to overcome this lock issue.

is there a way where other porcess can have read access, and i can able to update. so that other process will not fail at the same time

 

Thanks,

Kenneth.

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

OK, in that case you could try the FILELOCKWAIT option on the LIBNAME being used for this library, to get your batch jobs to wait until the dataset frees up. I use this myself and it works well. This option works under both Unix and Windows.

View solution in original post

7 REPLIES 7
ballardw
Super User

Use system tools to identify which program is Process=111111 (or whatever the actual value may be). Then diagnose why that program is using the file. Then make sure it isn't using the file when you want to update.

 

 

Some programs just lock files when using them, even for "read only". Though I consider attempting to update data while another program is reading it is a way to creating inconsistent reports and such.

 

 

SASKiwi
PROC Star

How are you updating this dataset? In SAS batch jobs, running programs in EG, SAS Studio, SAS Windowing System or some other way? Bear in mind that viewing a SAS dataset in EG, SAS Studio, SAS Windowing System will lock it and prevent it from being updated. You need to identify what processes are locking it before deciding on how to avoid it.   

Asbon
Obsidian | Level 7
It’s a batch job, runs in tivoli scheduler.
There are multiple processes will be connecting to master dataset from same scheduler.But Master dataset also need to updated same time.
SASKiwi
PROC Star

OK, in that case you could try the FILELOCKWAIT option on the LIBNAME being used for this library, to get your batch jobs to wait until the dataset frees up. I use this myself and it works well. This option works under both Unix and Windows.

Asbon
Obsidian | Level 7

libname abc path/aaaa/bbb filelocks=none;

 

above is removing existing file lock if any.

Kurt_Bremser
Super User

@Asbon wrote:

libname abc path/aaaa/bbb filelocks=none;

 

above is removing existing file lock if any.


Wrong. From the documentation of LIBNAME on UNIX:

FILELOCKS=NONE | FAIL | CONTINUE

specifies whether file locking is turned on or off for the files that are opened under the libref in the LIBNAME statement. The FILELOCKS statement option works like the FILELOCKS system option, except that it applies only to the files that are associated with the libref. The following values for the FILELOCKS statement option are available:

NONE

turns file locking off. NONE specifies that SAS attempts to open the file without checking for an existing lock on the file. NONE does not place an operating system lock on the file. These files are not protected from shared Update access.

FILELOCKS=NONE will only prevent checking for a lock and setting a lock, but if another process has a lock on the file, the operating system will prevent access. And if two SAS sessions update the dataset simultaneously, it will most likely be destroyed.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 1470 views
  • 2 likes
  • 4 in conversation