Example of QUERY command

Suppose you want to write an application that will perform the following query:
  • Find all PTF and USERMOD type SYSMODs having an FMID of HMP1E00 that were received after December 1, 2008 and that were applied with BYPASS(anything). Return the SYSMOD name, the zone, the MODs that are replaced by the SYSMOD, and the installation date.
The storage containing the input parameters may be represented like this:
Storage containing input parameters
Note: The SYSMOD name and zone are automatically returned without your asking for them.

QPARM is a variable containing a pointer to a QUERY_PARMS data structure. The elements of the data structure point to strings in storage containing the values of the parameters.

Your program would then execute this call:
  GIMAPI('QUERY',QPARM,QRESULT,'ENU',RC,CC,MSGBUFF)

The result of the query is two SYSMODS, SMOD019 and SMOD022. SMOD019 is in target zone TARG1 with two MODs, MOD01 and MOD02 and was installed on December 6, 2008. SMOD022 is in target zone MYTARG and has no MODs. It was installed on December 14, 2008.

Figure 1 provides a picture of what the output storage looks like. See topic Data structures for QUERY command for a description of the data structures used in the picture.
Figure 1. Picture of storage for query output
Storage for query output
Note: There are no values for the MOD subentry for SYSMOD SMOD022. Therefore, no SUBENTRY structure is added to the output for that subentry type.