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.obj_list() UDTF returns one row for each object that matches the search criteria.
iQuery.obj_list( library-name, object-name, object-type, object-status )
The library-name is the name of the library that contains the objects to be listed. In addition to a specific library name, the special values *ALL, *ALLUSR, *USRLIBL, *LIBL, and *CURLIB may be specified.
The optional object-name is the name of the object to be included. A generic or full name may be specified. The default is *ALL.
The optional object-type specifies the whose fields propertiestype of objects to be listed. The default is *ALL Any valid IBM i operating system object type may be specified.
The optional object-status can be *, *ALL, D, P, or DP. * and *ALL mean all objects. D means damaged objects and P means partially damaged objects. When D or P is specified, only objects that match those statuses are returned. *ALL or * return all objects regardless of status. The use of D and/or P is to isolate the list to damaged or partially damaged objects only.
Column | Type | Description |
OBJNAME | varchar(10) | The name of the object whose description has been returned in this row. |
OBJLIB | varchar(10) | The library name of the object. |
OBJTYPE | varchar(10) | The Object Type of the object. |
OBJSTATUS | char(1) | The object damaged or locked status. D=Damaged, P=Partial Damage, L=Object Locked. |
OBJTEXT | varchar(50) | The text description for the object. |
OBJOWNER | varchar(10) | The owner of the object. |
OBJCREATOR | varchar(10) | The user profile that created the object. |
CRTDATE | DATE | The object Creation Date. |
CRTTIME | TIME | The object Creation Time |
CRTSYSNAME | varchar(10) | The system on which the object was created. |
DAMAGED | varchar(10) | Damed Object Attribute: *DAMAGED, *PARTIAL or blank. |
ASP | smallint | The ASP where the object exists. |
DOMAIN | varchar(10) | The domain where the object exists (system or user domain) |
CRTVRM | varchar(9) | The version of IBM i on which the object was created. The format is VxRyMz |
TGTRLS | varchar(9) | The value of the TGTRLS parameter when the object was created. The format is VxRyMz |
ACTGRP | varchar(10) | The name of the activation group in which the object runs if *PGM or *SRVPGM. The special values *DFTACTGRP, *NEW, and *CALLER may also be returned. |
CGHDATE | DATE | The Last Changed Date of the object. |
CHGTIME | TIME | The Last Changed Time of the object. |
SRCFILE | varchar(10) | The source file used to create the object (if any). |
SRCLIB | varchar(10) | The source library that contains the source file used to create the object (if any) |
SRCMBR | varchar(10) | The source member name used to create the object (if any) |
LASTSAVEDDATE | DATE | Last Date when a save of the object occurred. |
LASTSAVEDTIME | TIME | Last Time a save of the object occurred. |
LASTRESTOREDDATE | DATE | The date when the object was last restored. |
LASTRESTOREDTIME | TIME | Last Time the object was restored. |
LASTUSEDDATE | DATE | The date when the object was last used. |
LASTUSEDTIME | TIME | The time on the last used date when the object was used (often not specified) |
DAYSUSED | INT | The number of days the object has been used. |
The following creates a list of all objects in library COZTOOLS and includes the creation date and last used date.
select objname, objlib, objtype, crtdate, lastUsedDate, daysUsed
from table(iquery.obj_list('COZTOOLS')) OL
An excerpt from the resultSet generated by the above statement follows:
OBJNAME OBJLIB OBJTYPE CRTDATE LASTUSEDDATE DAYSUSED COZLANGEN COZTOOLS *MSGF 2014-08-28 2019-06-18 947 COZTOOLS COZTOOLS *MSGF 2013-10-28 2019-06-09 429 APPTOOLS COZTOOLS *FILE 2014-04-04 2019-06-20 1494 ASKDATE COZTOOLS *FILE 2018-11-05 2019-06-09 3 ASKUSER COZTOOLS *FILE 2018-11-05 ---------- 0 CLPSAMPLES COZTOOLS *FILE 2013-03-21 2018-11-05 67 COZASCPRN COZTOOLS *FILE 2012-10-23 2018-11-05 42 COZEVENTS COZTOOLS *FILE 2012-06-29 ---------- 0 COZSAVSPLF COZTOOLS *FILE 2012-07-28 ---------- 0 COZSYSDFT COZTOOLS *FILE 2012-05-16 ---------- 0 EDITCODES COZTOOLS *FILE 2015-07-16 2019-06-05 2 EVFEVENT COZTOOLS *FILE 2018-07-02 2019-06-20 278