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.ifsDir() UDTF returns a one row result that contains the attributes for the specified IFS file. The information returned in similar to that which is returned by the stat64() C runtime function.
table( iQuery.ifsDir( 'fully-qualified IFS directory', optional-recursion flag ) )
The Fully-Qualified IFS Directory name is the name of the IFS directory, such as '/home' whose entries are to be returned.
The Optional Recursion Flag causes the UDTF to drill down into each subdirectory and include the entries for those subdirectories in the resultSet.
Column | Type | Description |
ENTNAME | varchar(640) | The name of the IFS directory's Entry. Typically the file name or the subdirectory name. |
ENTTYPE | varchar(10) | The entry type. Either STMF or DIR (note the leading asterisk is NOT returned by this UDTF) |
ENTSIZE | BIGINT | The number of bytes the file occupies on disk. (the file size) |
CRTDTS | timeStamp | The date/time when the entry was created. |
ACCDTS | timeStamp | The date/time when the entry was last accessed. |
CHGDTS | timeStamp | The date/time the entry's attributes where last changed. |
MODDTS | timeStamp | The date/time the data in the file was last modified. |
ENTEXT | varchar(10) | File Extension. For example, if the file name is SALES.PDF, this column contains: PDF |
ENTNAMELEN | smallint | The length of the data in the ENTNAME column. |
ENTFULLNAMELEN | smallint | The length of the fully qualified full name ENTFULLNAME column value. |
ENTFULLNAME | varchar(2048) | The fully qualified entry name (first 2048 characters). |
select entType,entSize,crtdts,entName from table( iQuery.ifsDir( '/home/iquery') ) dir;
The output from the above UDTF would be similar to the following:
ENTTYPE ENTSIZE CRTDTS ENTNAME
DIR 45056 2013-03-01 12.12.20.000000 xtools
STMF 3949 2013-03-01 11.57.45.000000 country.txt
STMF 714 2013-03-01 11.57.45.000000 msgpopup.html
DIR 12288 2014-02-11 12.04.38.000000 testmystuff
DIR 8192 2013-07-25 15.50.09.000000 cvtimage
DIR 98304 2013-11-13 11.56.36.000000 jpeg-9a
DIR 8192 2014-02-24 09.45.51.000000 ccDev
DIR 8192 2016-08-21 13.09.07.000000 com
STMF 18944 2019-06-12 19.10.09.000000 QCUSTCDT.xls
DIR 8192 2015-05-12 10.59.03.000000 json