# Custom queries

This section provides tips and suggestions regarding queries that you create for the Dataset Attributes Database feature:

- Queries that you create for the Data Set Details table (a query that involves the entire data set attribute database) must have at least one predicate specified. If you use only one attribute for selection, you cannot use the attribute in conjunction with `STR` or `COUNT`.
- You must use uppercase characters for the character string values in your queries, such as data set name or volume serial number. Otherwise, the data is not displayed in the Tivoli® Enterprise Portal.
- A single custom query can return a maximum of 16000 rows. This behavior prevents storage shortages and potential abends in the Tivoli Enterprise Monitoring Server. A query (for example, DSORG=PO) might match a large number of data set detail rows. This processing load can negatively affect all other IBM® Tivoli Monitoring applications.
- When you specify the predicate for a custom query, position the most specific attribute as the first column so that it functions as the primary index. The primary index limits the search for the additional attributes and, if specified with sufficient granularity, can greatly reduce response time.

  For example, if you want to see all data sets that are greater than 1000 cylinders on volume PRI000, specify the VOLUME attribute as primary index, so that the query initially searches for data sets from volume PRI000 only. (If you specify the number of cylinders (1000) as the primary index, the query finds every data set in the z/OS® environment that is larger than 1000 cylinders and then selects those that are located on PRI000. This query would be much more time consuming.)

- The string `00:00:00` functions as a wildcard specification in queries that use Creation Date, Last Reference Date or Expiration date. Specify the Time value of such queries to be `00:00:00` because that value does not have a time associated with it and the returned converted times must not contradict the query specification.
- The following examples show the potential value of queries:
  - To see all components associated with a specific VSAM Cluster, enter the cluster name in the Associated Dataset attribute column.
  - Find VSAM data sets that have REPLICATE or IMBED.
  - Locate Uncataloged VSAM data sets.
  - Identify catalogs that have exceeded a threshold number of extents.