07-28-2016 10:11 PM
Could someone please suggest me a method/function that helps SAS not to stop/terminate when a non sas file like a LOG file is in use. The LOG file is not used/opened by me, I guess Windows or some third party app is doing it. Any suggestion would be of great use.
07-28-2016 11:17 PM
07-30-2016 09:53 PM
Its a log file that I get from running SAS in BATCH. I do not use/read it other than in notepad++ to check where/how the program is.
So you open the log file in Notepad++ and then SAS throws an error because it's locked? What happens if you don't open file while process is running? Do you still get a File Lock?
07-30-2016 10:11 PM
Not really. I look at the log only after the program has finished running. But I have the program itself opened in NOTEPAD++. But this file locking started to happen very recently. I know that Notepad++ dont keep a lock on the file, but still?. The worst part is that It happens randomly(days) to the same program.
07-29-2016 03:32 AM
If a file is explicitly locked for any type of access (not just write/update), there's nothing you can do except identify the process that holds the lock, and then terminate it.
Which is a very rude way to go about it. (And you need to have the rights/permissions to do this. I have found that the execrable Windows does not really have a "superuser" type UserID like UNIX. Even "the" Administrator is often unable to to stop a process, short of restarting the system.)
So, after having identified the offending process with operating system tools, check why the file is locked. If there is an update underway at the moment SAS tries to read the file, the lock is quite natural. In this case you have to set up time windows during which the file will not be updated so SAS can safely read it.
07-30-2016 09:48 PM
Could you please tell me what you meant by "In this case you have to set up time windows during which the file will not be updated so SAS can safely read it."
07-29-2016 04:43 AM
Just going to ad to the great advice above, encountering file locks should be almost never. If you are finding files locked then you have a structural or process fault. For instance, if you have users who use the data, then don't have them doing that in the production branch, otherwise when you try to run production you will encounter this. A way of seperating users working areas out from production (which should be run at fixed - known times) shuld remove file lock issues.
07-30-2016 09:51 PM
I agree with what you have said,RW9. But in my case I have no idea why the log file gets locked. If I know that some app/OS is holding the lock, then I can manually terminate it.
07-31-2016 05:43 AM
Speak to your IT team, they will help finding out what application is locking the file. Text files generally don't get locked, so that is unusual. That being said, my company has applications running the background which mirror files off to a backup, and that sometimes prevents me deleting files or folders, so it could be something like that. Its a system thing though, not really a SAS problem.
07-30-2016 10:51 PM