Detecting unused objects on the system

Information provided in the object description can help you detect and manage unused objects on the system.

To detect an unused object, look at both the last-used date and the last-changed date. Change commands do not update the last-used date unless the commands cause the object to be deleted and created again, or the change operation causes the object to be read as a part of the change.

  • Date and time of last change
    • When an object is created or changed, the system time stamps the object, indicating the date and time the change occurred.
  • Date of last use
    • The date of last use is only updated once per day (the first time an object is used in a day). The system date is used.
    • An unsuccessful attempt to use an object does not update the last used date. For example, if a user tries to use an object for which the user is not authorized, the date of last use does not change.
    • The date of last use is blank for new objects.
    • When an object that already exists on the system is restored, the date of last use comes from the object on the system. If it does not already exist when restored, the date is blank.
    • Objects that are deleted and re-created during the restore operation lose the date of last use.
    • The last used date for a database file is not updated when the number of members in the file is zero. For example, if you use the Create Duplicate Object (CRTDUPOBJ) to copy objects and there are no members in the database file, the last used date is not updated.
    • The last used date for a database file is the last used date of the file member with the most current last used date.
    • For logical files, the last used date is the last time a logical member (or cursor) was used.
    • For physical files, the last used date is the last time the data in the data space was used through a physical or logical access.
    • Objects that are deleted and re-created during the rename operation lose the date of last use.
  • Date of last activity
    • Date of last activity is the last date for which data transfer, session or conversation establishment, or use of the hardware associated with a device description occurred.
    • Because the date of last use is updated when a device, controller status, or both go beyond vary-on pending, the date of last use does not accurately reflect the use of the configuration description. For example, if you set virtual devices, controllers, or both to ONLINE(*YES), although no data transfer or communications are established on the device, the date of last use is updated when an initial program load (IPL) is processing and the device is varied on. However, date of last activity is not updated, which can reflect the accurate use of the configuration description.
Table 1. Updating usage information
Type of object Commands and operations
All object types Create Duplicate Object (CRTDUPOBJ) command and other commands, such as the Copy Library (CPYLIB) command, that use CRTDUPOBJ to copy objects.

Grant Object Authority (GRTOBJAUT) command (for referenced objects)

Binding directory When bound with another module or binding directory to create a bound program (CRTPGM command) or bound service program (CRTSRVPGM command). When updated on the Update Program UPDPGM command or Update Service Program (UPDSRVPGM command).
Change Request Description Change Command Change Request Activity (CHGCMDCRQA)
Chart format Display Chart (DSPCHT) command
C locale description Retrieve C Locale Description Source (RTVCLDSRC) command or when referred to in a C program
Class When used to start a job
Command When run

When compiled in a CL program

When prompted during entry of source entry utility (SEU) source

When calling the system in check mode

Note: Prompting from the command line and then pressing F3 is not counted as a use of a command.
Communications side information (CSI) When the CPI-Communications Initialize Conversation (CMINIT) call is used to initialize values for various conversation characteristics from the side information object.
Connection list When the connection list goes beyond status of vary on pending
Cross system product map When referred to in a CSP application
Cross system product table When referred to in a CSP application
Controller description When the controller goes beyond status of vary on pending
Device description When the device goes beyond status of vary on pending
Data area Retrieve Data Area (RTVDTAARA) command

Display Data Area (DSPDTAARA) command

Data queue Usage information for the following APIs is updated only once per job (the first time one of the APIs is initiated).

Send Data Queue (QSNDDTAQ) API

Receive Data Queue (QRCVDTAQ) API

Retrieve Data Queue (QMHQRDQD) API

Read Data Queue (QMHRDQM) API

File (database file only unless specified otherwise) When closed (other files, such as device and save files, also updated when closed)

When cleared

When initialized

When reorganized

Commands:

  • Apply Journaled Changes (APYJRNCHG) command
  • Remove Journaled Changes (RMVJRNCHG) command
Font resource When referred to during a print operation
Form definition When referred to during a print operation
Graphics symbol set When referred to by a GDDM* or PGR graphics application program

When loaded internally or using GSLSS

Job description When used to establish a job
Job schedule When the system submits a job for a job schedule entry

When the user takes 'Option 10 = submit immediately' from the WRKJOBSCDE panel

Job queue When an entry is placed on or removed from the queue
Line description When the line goes beyond status of vary on pending
Locale Retrieve locale API QLGRTVLC

When a job starts if the user profile LOCALE value contains a path name to a valid *LOCALE object.

Management collection Only updated by commands and operations that affect all object types.
Media definition The SAVLIB, SAVOBJ, RSTLIB, RSTOBJ, SAVCHGOBJ commands; as well as, the BRMS and QSRSAVO API.
Menu When a menu is displayed using the GO command
Message files When a message is retrieved from a message file other than QCPFMSG, ##MSG1, ##MSG2, or QSSPMSG (such as when a job log is built, a message queue is displayed, help is requested on a message in the QHST log, or a program receives a message other than a mark message)

Merge Message File (MRGMSGF) command except when the message file is QCPFMSG, ##MSG1, ##MSG2, or QSSPMSG

Message queue When a message is sent to, received from, or listed message queue other than QSYSOPR and QHST
Module When bound with another module or binding directory to create a bound program (CRTPGM command) or bound service program (CRTSRVPGM command). When updated on the Update Program (UPDPGM) command or Update Service Program (UPDSRVPGM) command.
Network interface description When the network interface description goes beyond status of vary on pending
Node List Only updated by commands and operations that affect all object types
Output queue When an entry is placed on or removed from the queue
Overlay When referred to during a print operation
Page definition When referred to during a print operation
Page segment When referred to during a print operation
Panel group When the Help key is used to request help information for a specific prompt or panel, the date of usage is updated

When a panel is displayed or printed from a panel group

PDF map Add PDF Map Entry (QPQAPME) API

Work with PDF Map Entries (WRKPDFMAPE) command

Print descriptor group When referred to during a print operation
Product Availability Only updated by commands and operations that affect all object types
Product Load Only updated by commands and operations that affect all object types
Program Retrieve CL Source (RTVCLSRC) command

When run and not a system program

PSF Configuration When referred to during a print operation
Query definition When used to generate a report

When extracted or exported

Query manager form When used to generate a report

When extracted or exported

Query manager query When used to generate a report

When extracted or exported

Search index When the F11 key is used through the online help information

When the Start Search Index (STRSCHIDX) command is used

Server storage Vary Configuration (VRYCFG) is run against a network server description object
Service program When a bound service program is activated
SQL Package Only updated by commands and operations that affect all object types
Start of changeSQL XML schema repositoryEnd of change Start of changeOnly updated by commands and operations that affect all object typesEnd of change
Subsystem description When subsystem is started
Spelling aid dictionary When used to create another dictionary

When retrieved

When a word is found in the dictionary during a spell check and the dictionary is not an IBM-supplied spelling aid dictionary

Table When used by a program for translation
Time zone description
  • Starting a job with the time zone description.
  • Referencing the time zone description in order to calculate a new current offset when a DST (Daylight Savings Time) boundary is crossed.
User profile When a job is initiated for the profile

When the profile is a group profile and a job is started using a member of the group

Grant User Authority (GRTUSRAUT) command (for referenced profile)

Workstation User Customization Only updated by commands and operations that affect all object types

The following is additional object usage information provided in the object description:

  • Counter of number of days used
    • The count is increased when the date of last use is updated.
    • When an object that already exists on the system is restored, the number of days used comes from the object on the system. If it does not already exist when restored, the count is zero.
    • Objects that are deleted and re-created during the restore operation lose the days used count.
    • The days used count is zero for new objects.
      Note: The IBM® i operating system cannot determine the difference between old and new device files. If you restore a device file on to the system and a device file of that same name already exists, delete the existing file if you want the days used count to be reset to zero. If the file is not deleted, the system will interpret this as a restore operation of an old object and retain the days used count.
    • The days used count for a database file is the sum of the days used counts for all file members. If there is an overflow on the sum, the maximum value (of the days used counts field) is shown.
  • Date days used count was reset
    • When the days used count is reset using the Change Object Description (CHGOBJD) command or the Change Object Description (QLICOBJD) API, the date is recorded. The user then knows how long the days used count has been active.
    • If the days used count is reset for a file, all of the members have their days used count reset.

Common situations that can delete the days used count and the last used date are as follows:

  • Restoring damaged objects on the system.
  • Restoring programs when the system is not in a restricted state.

The Display Object Description (DSPOBJD) command can be used to display a full description of an object. You can use the same command to write the description to an output file. To retrieve the descriptions, use the Retrieve Object Description (RTVOBJD) command.

Note: The Retrieve Object Description (QUSROBJD) API provides the same information as the Retrieve Object Description command.

The Retrieve Member Description (RTVMBRD) command and Display File Description (DSPFD) command provide similar information for members in a file.

Object usage information is not updated for the following object types:

  • Alert table (*ALRTBL)
  • Authorization list (*AUTL)
  • Configuration list (*CFGL)
  • Class-of-service description (*COSD)
  • Data Dictionary (*DTADCT)
  • Double-byte character set dictionary (*IGCDCT)
  • Double-byte character set sort (*IGCSRT)
  • Double-byte character set table (*IGCTBL)
  • Edit description (*EDTD)
  • Exit Registration (*EXITRG)
  • Filter (*FTR)
  • Forms control table (*FCT)
  • Folder (*FLR)
  • Internet Packet Exchange Description (*IPXD)
  • Journal (*JRN)
  • Journal receiver (*JRNRCV)
  • Library (*LIB)
  • Mode description (*MODD)
  • Network Server Configuration (*NWSCFG)
  • Network Server Description (*NWSD)
  • NetBIOS Description (*NTBD)
  • Product definition (*PRDDFN)
  • Reference code translation table (*RCT)
  • Session description (*SSND)
  • S/36 machine description (*S36)
  • User-defined SQL type (*SQLUDT)
  • User queue (*USRQ)