IFSPATH( path_name => '*HOME', subtree => '*NO' | '*YES', objtype => '*ALL' | '*DIR' | '*STMF', omit_list => '*NONE' | 'omit_pattern' )
The IFS Directory Path Entries (IFSPATH) User Defined Table Function returns one row for each object in the specified PATH_NAME. If SUBTREE=>'*YES' is specified, then the files in the sub-directories within the main path-name are also included.
The path name whose file and folders names are listed. If the default *HOME is specified, the home folder associated with the User Profile is used.
The when *YES is specified, then any folders within the PATH_NAME value will also be included in the resultSet as will any files in those subfolders.
The object type of the IFS object being returned. The valid choices are *DIR (for folders/directories) and *STMF (stream file names). When *ALL is specified or no OBJTYPE parameter is specified then both folders and files are returned. The leading asterisk is optional. One or more object types is supported, but *ALL or no object type is the same as specifying both *STMF *DIR. For example: subtype=>'dir stmf'. The SQL WHERE clause can also accomplish this however the difference is that the row is never returned unless it matches the object type(s) specified.
To prevent certain patterns from being returned, the OMIT_LIST can be used or the SQL WHERE clause can be used. The difference is the OMIT_LIST avoids returning the row if it matches the omit_pattern. Note the entry matches the omit_pattern if it begins with the same character string as that specified on the OMIT_LIST parameter. Upper/lower case is ignored.
Return a list of files in the home directory sorted by the file size in descending order:
select objtype, data_size, objname
FROM TABLE( iQuery.IFSPATH( objtype => '*stmf' )) homeDir ORDER BY DATA_SIZE desc;
Return the top 100 largest objects on the IFS in all HOME directories for all users:.
FROM TABLE( iQuery.IFSPATH( path_name=>'/home', objtype=>'*STMF')) bigOnes
ORDER BY data_size
LIMIT 100 rows OPTIMIZE for 100 Rows;
|| Data Type
||The type of object(s) to be returned. DIR or
STMF is returned.
||VARCHAR(640)||The name of the file or folder.
||BIGINT||The size of the object, in bytes. Note, in
RPG IV this would be defined as int(20). In C/C++ it is a
long long variable.
||VARCHAR(10)||The owner of the IFS object.
||timeStamp||The date the object was created. This is a
||The date and time the object was last access
(view, written to, opened).
||timeStamp||The date and time the object definition was
||The date and time the data in the object (if
it is a STMF) was changed/modified.
||If the object in the OBJNAME column is a
STMF, then this column contains the file suffix. For
example, f a file's name is MONTHYENDSALES.XLS, this column
contains 'XLS' for that file. Otherwise this column is
||SMALLINT||The length of the name of the object as
returned in OBJNAME. This column is for selection purposes.
For example if you want to check for excessively long file
||The length of the fully qualified object name
returned in the PATH_NAME column.
||The fully qualified object name. This column
contains the file name prefixed with the path name vs the
OBJNAME column which contains only the object name.