Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
The iQuery.ifsExists() UDF checks if the specified IFS file exists on the IFS. If it exists, it returns 1, otherwise it returns 0.
iQuery.ifsExists( 'IFS file and path' )
The IFS File and Path parameter identifies the name of the IFS file to confirm that it exists. If the file exists, the UDF returns 1 otherwise it returns zero (0).
UDF | Return Type | Description |
ifsExists | integer | A returned value of 0 means the files does NOT exist. A returned value of 1 means the file was found. |
Example
select iQuery.ifsExists('/home/cozzi/order12345.pdf') INTO :Exists
from sysibm.sysdummy1;
if (exists = 0); // File does not exist?
// create the IFS file
endif;