Midrange News for the IBM i Community


Posted by: Bob Cozzi
Rogue Programmer
Cozzi Productions, Inc.
Chicagoland
SQL iQuery Documentation - UDF and UDTF
has no ratings.
Published: 17 Jun 2019
Revised: 20 Aug 2019 - 1708 days ago
Last viewed on: 22 Apr 2024 (830 views) 
  1. SQL iQuery - RUNiQRY CL Command
  2. CSV() - Read and Parse Comma Separated Values File
  3. CSV_VAL() Extract CSV Column Value
  4. CSV_XXXX() Extract CSV Column Value as xxxx
  5. CSV_COUNT - Retrieve Field Count
  6. ObjExist - Check Object Exits
  7. DTAARA - Data Area
  8. encode_URL Encode URL for the Web
  9. encode_TAG Encode HTML TAG Content
  10. FLDLIST - List the Fields of a Table
  11. FROMHEX - Fold 2-hex Chars into 1 Char
  12. GET CPUCNT, CURLIB, ENV, SRLNBR, SYSNAME
  13. MD5_HASH - UDF - Return MD5 Hash
  14. ifsStat - Get IFS File Attributes
  15. ifsExists - Check if IFS File Exists
  16. ifsFile - Query Contents of IFS Text File
  17. ifsDIR - List IFS Directory Entires
  18. DEPFILE - List Dependent Database Relations
  19. JOB - Get Job Name Component
  20. Job_ATTR - Job Attributes
  21. JOB_DATE Retrieve the Job Date
  22. JOBLOG - Write Message to Joblog
  23. Library List UDF and Procedures
  24. MBRLIST - Member List
  25. MCHINFO Machine Type and Model Number and OS version
  26. OSVER and OSVRM Get IBM i Version/Release
  27. PrintPDF - Print a PDF to a PDF Compatible Printer
  28. CPYTOPDF - Copy SPOOLED File to PDF file
  29. OBJ_LIST List Object in a Library
  30. LIB_LIST List Descriptions of Libraries on the Library List
  31. OBJ_EXPORTS List Exported Items from an Object
  32. OBJ_STRUCT Retrieve Objects Components
  33. RTVCMDD Retrieve Command Definition
  34. RTVJOBA - Retrieve Job Attributes
  35. RTVJOBD - Retrieve Job Description
  36. RTVLASTSPLF - Retrieve ID of Last SPOOLED File for this Job
  37. RTVxxx - Retrieve Various Objects Description Table Functions
  38. WATCHLIST - List Current Watches
  39. Polymorphic Qualified Name Syntax

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.

iQuery.ifsDir - UDTF Published by: Bob Cozzi on 17 Jun 2019 view comments

List IFS Directory Entries and Attributes

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.

Parameters

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.

Result Set Columns

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).

Example

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         

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS