When SAS accesses a
file, it normally attempts to obtain a SAS system file lock and an
operating system file lock. If either of these locks cannot be obtained,
SAS does not access the file.
SAS
system file locking is performed on all types of files that SAS accesses.
However, the AUTO and SHARED values control only the default SAS system
file locking for external files. It prevents a SAS application from
using a particular file in a manner that is incompatible with how
the file is currently being used by other SAS applications within
the same SAS session. The AUTO and SHARED values specify a default
value for SAS system file locking for external files for which the
LOCKINTERNAL option of the FILENAME statement was not specified.
SAS recommends that you specify FILELOCKS=INTERNAL, and that you specify
FILELOCKS=SHARED only for the files that require simultaneous read
and write access. External files are files that are identified by
the FILENAME statement or related internal SAS facilities. For more
information, see
Definition of External Files in SAS Language Reference: Concepts.
Note: SAS system file locking governs
use of a file by two separate applications within a single SAS session,
or by two separate clients of the same SAS server.
Operating system file
locking prevents the current SAS session from using a particular file
in a manner that is incompatible with how the file is being used by
another
z/OS batch job, TSO user, or other
z/OS process. Use the
path and
setting values
to specify operating system file locking for SAS files, external files,
and utility files residing in a UFS directory. SAS attempts to place
an exclusive lock when it needs to modify or rewrite the file. The
operating system grants this request only if no other address spaces
(batch jobs, TSO users, or
z/OS processes) hold a lock (shared or
exclusive) on the file. If SAS merely needs to read the file, then
it attempts to place a shared lock. The operating system grants this
request only if no other address spaces hold an exclusive lock on
the file. However, multiple address spaces can simultaneously hold
a shared lock on the same file.
Note: Operating system file locking
for UFS files is implemented via the UNIX System Services
fcntl()
function.
When the value of the
FILELOCKS option is a set of
path and
setting values
for a UFS file, the values must be enclosed in parentheses. The AUTO
and SHARED values should not be enclosed in parentheses.
You can specify multiple
instances of the FILELOCKS option to establish different settings
for various paths. One path can be a subdirectory of another path.
In that case, the most specific matching path currently in effect
governs operating system file locking. The following example shows
how you can specify multiple instances of the FILELOCKS option in
a configuration file.
FILELOCKS = AUTO
filelocks=('/u/myuserid/temp' NONE)
filelocks=('/tmp' CONTINUE)