FILELOCKS= System Option: z/OS

Specifies the default SAS system file locking that is to be used for external files (both UFS and native MVS). Also specifies the operating system file locking to be used for UFS files (both SAS files and external files).
Valid in: Configuration file, SAS invocation, OPTIONS statement
Categories: Files: External Files

Files: SAS Files

PROC OPTIONS GROUP= ENVFILES

EXTFILES

SASFILES

Default: AUTO; ( '/ ' FAIL )
z/OS specifics: All

Syntax

FILELOCKS=AUTO | SHARED
FILELOCKS= (path setting)

Required Arguments

AUTO
specifies that SAS system locking for external files is performed as if the LOCKINTERNAL=AUTO option value had been specified in the FILENAME statement (unless another value for LOCKINTERNAL was specified). For more information, see the LOCKINTERNAL option of FILENAME Statement: z/OS. AUTO is valid only in the configuration file and at SAS invocation.
SHARED
specifies that SAS system locking for external files is performed as if the LOCKINTERNAL=SHARED option value had been specified in the FILENAME statement (unless another value for LOCKINTERNAL was specified). When SHARED is in effect for a particular file, one SAS application can write a file at the same time that one or more other SAS applications are reading the file. For more information, see the LOCKINTERNAL option of FILENAME Statement: z/OS. The SHARED value is valid only in the configuration file and at SAS invocation.
path
specifies a path for a UFS directory. Use path with setting to specify an operating system locking value for a UFS directory.
setting
specifies the operating system locking value for the specified path. Use setting only when you specify a UFS directory with path. The setting value can be one of the following values:
FAIL
SAS attempts to place an operating system lock on the file. Access to the file is denied if the file is already locked, or if it cannot be locked.
NONE
SAS opens the file without checking for an existing lock on the file, and does not place an operating system lock on the file.
CONTINUE
SAS attempts to place an operating system lock on the file. If a file is already locked by someone else, an attempt to open it fails. If the file cannot be locked for some other reason, then the file is opened.

Details

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)