I got an error as follows while reading the file. Only I work on this file and I've closed it before running SAS program. Could someone guide me to overcome this error?
NOTE: The variable fname exists on an input data set, but was also specified in an I/O statement option. The variable will not be
included on any output data set.
Resource is write-locked by another user. File
=/usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-29_tmp_18208.log. System Error Code =
0.
ERROR: File is in use, /usr/sas/sas_config/Lev1/SASApp/StoredProcessServer/Logs/SASApp_STPServer_2015-09-29_tmp_18208.log.
SASApp_STPServer_2015-09-29_tmp_18208.log seems to be a log file automatically created by stp server. Why do you want to read/write it?
I need to read the log file to create a dataset. My question is how to get rid of the error 'file is in use'?
Can you check which process is responsible for the lock? Afaik the STP-server and its sas-processes do not lock their log files.
Edit: http://superuser.com/questions/97844/how-can-i-determine-what-process-has-a-file-open-in-linux
My log file is in the below location. I did checked the process running in this folder and I could found below.
-bash-4.1$ lsof /usr/sas/tir/test/loganalysis/
lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /root/.gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 6394 sas cwd DIR 253,2 4096 9718657 /apps/tir/test/loganalysis
lsof 10676 sas cwd DIR 253,2 4096 9718657 /apps/tir/test/loganalysis
lsof 10677 sas cwd DIR 253,2 4096 9718657 /apps/tir/test/loganalysis
-bash-4.1$
Do I need to kill all the PID?
I could not delete that process as well. Could someone guide me?
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.