z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


access

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-access--pathname--flags-------------------------------------><

Function

access invokes the access callable service to determine if the caller can access a file.

Parameters

pathname
The pathname of the file to be checked for accessibility.
flags
One or more numeric values that indicate the accessibility to be tested. You can specify a numeric value (see REXX predefined variables) or the predefined variable used to derive the appropriate numeric value. The predefined variables you can specify are:
Variable Description
F_OK Test for file existence
R_OK Test for permission to read
W_OK Test for permission to write
X_OK Test for permission to execute
For example, R_OK+W_OK tests for read and write permission.

Usage notes

  1. Testing for file permissions is based on the real user ID (UID) and real group ID (GID), not the effective UID or effective GID of the calling process.
  2. The caller can test for the existence of a file or for access to the file, but not both.
  3. In testing for permission, the caller can test for any combination of read, write, and execute permission. If the caller is testing a combination of permissions, a -1 is returned if any one of the accesses is not permitted.
  4. If the caller has appropriate privileges, the access test is successful even if the permission bits are off, except when testing for execute permission. When the caller tests for execute permission, at least one of the execute permission bits must be on for the test to be successful.

Example

To test for permission to execute grep:
"access '/bin/grep'" x_ok

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014