Just found this great SQL UDF (user defined function) QSYS2.SQL_CHECK_AUTHORITY(‘library’,’file’) that IBM put into V7R1. It allows you to check if the current user can select a file. It returns 0 if they are now allowed to query the file otherwise 1. This beats getting the SQL Permissions Error and having to use a try catch block in PHP to capture the naming exception.

[sourcecode language=”SQL”]
SELECT QSYS2.SQL_CHECK_AUTHORITY(‘LIBRARY’,’FILE’) FROM SYSIBM.SYSDUMMY1
[/sourcecode]