IFS_ACCESS scalar function
The IFS_ACCESS scalar function determines whether a file can be accessed in a particular manner.
This function uses the access()--Determine File Accessibility API. When checking whether a job has appropriate permissions, the API looks at the real user ID (UID) and group ID (GID), not the effective IDs. Adopted authority is not used.
The function requires that Option 13 (System Openness Includes) of the IBM i operating system is installed.
Authorization: See Note below.
- path-name
- A character string containing the path of the file to be checked.
- read
- Test whether the file can be accessed for reading.
- NO
- Do not check for read access. This is the default.
- YES
- Check for read access.
- write
- Test whether the file can be accessed for writing.
- NO
- Do not check for write access. This is the default.
- YES
- Check for write access.
- execute
- Test whether the file can be accessed for execution.
- NO
- Do not check for execute access. This is the default.
- YES
- Check for execute access.
Note
This function is provided in the SYSTOOLS schema as an example of how to embed a C language interface in an SQL scalar function. Similar to other Db2® for i provided tools within SYSTOOLS, the SQL source can be extracted and used as a model for building similar helper functions, or to create a customized version within a user-specified schema.
Services provided in SYSTOOLS have authorization requirements that are determined by the interfaces used to implement the service. To understand the authority requirements, extract the SQL for the service and examine the implementation.
Example
VALUES SYSTOOLS.IFS_ACCESS(PATH_NAME => '/usr/reportdata.txt',
READ => 'YES');