Is it possible to find out which particular user had the lock when a batch user wanted to write to the same log location. Can we know which user was trying to use the file at that time?
If you supply the log file name with the -log option on the commandline of your batch job, you can't do anything about this from within SAS, as the job will never start (SAS crashes upon invocation).
How you can find a user that keeps you from getting the write lock depends on the operating system; in UNIX, use the fuser command to retrieve the process ID's (numbers), from which you can then list the processes (and their owners) with ps -p.
1. There could be an issue of lock if two users are trying to write to the same file. Typically this does not happen. Typically locks are not held on folders having log files. (Unless you have some specific batch that is creating a folder)
2. What is your operating system on which the file / folder exists and the job is running?
There is a specific batch id that is creating the log files but in this case it doesn't allow to write to the log file stating "Resource is write-locked by another user"
Typically log file names are date and time stamped right down to hundredths of a second if the SAS jobs are run from a scheduler. That way it is near impossible for two jobs to write to the same log file and encounter a lock. You haven't provided any details on how your log files are named but date and time stamping them should avoid locks.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.