SELECT – Retrieve a record or common segment

Use the SELECT request to retrieve a record by specifying field names and values that identify the record you want to retrieve.

SELECT <resource> <arguments>

The SELECT statement is used to retrieve an individual record from the HCL Workload Automation for Z database or plans. You must set enough arguments to identify one record only; if the arguments apply to more than one record, the SELECT fails with RC=8 and the following message:
EQQY708E A SELECT REQUEST WITH MORE THAN ONE RECORD SELECTED,
         RESOURCE IS AD                                      

The SELECT and DELETE statements can be automatically generated from LIST requests (for details, see LIST – Find objects in the Database and Plans).

LIST statements can be automatically generated for other objects referred to by the object retrieved by the SELECT statement, or objects that may refer to the SELECT statement by using OPTIONS EXPAND(Y).

In the following example, the command retrieves the application MYAPPL and then LIST any event rules that may point to it and any workstation definitions, special resources, periods, referenced within it. SELECT(Y) causes any items found by the LIST processes to also have a SELECT statement run for them:
OPTIONS EXPAND(Y) SELECT(Y)
SELECT ADID(MYAPPL)

The end result being, if you have the relevant OUTPUT statements in place, that you obtain batch loader for the entire object and any other objects needed by it.

When you retrieve a record by using SELECT, you can get the complete record rather than just the common segment that is available from a LIST request. For example, SELECT AD retrieves the complete AD record, while SELECT ADCOM retrieves only the common segment.

Note:
  1. The SELECT JS and SELECT JSCOM requests try to retrieve JCL from the JCL repository. If no JCL is found, it is retrieved from the JCL library or through the job-library-read exit, EQQUX002. The full key is required, that is, the application ID, the input arrival time, and the operation number. You might need to precede the SELECT JS request by a LIST CPOPCOM request to get the key values.
  2. LIST JSCOM requests try to retrieve JCL only from the JCL repository.
  3. SELECT CPOPSRU can be issued for list elements only, from a list created by LIST CPOPSRU.
  4. The values of PIF arguments as dates depend on the PIF base year, which is defined by the PIFCWB keyword on the INTFOPTS statement, or the CWBASE keyword of the INIT statement. The value of the VALTO argument for default high date depends on the PIFHD keyword of the INTFOPTS statement or the HIGHDATE keyword of the INIT statement.
  5. CPST (current plan status) is only one record; therefore, select arguments are not required.
The return codes are:
0
The request was successful.
4
The request was not successful. No records meet the criteria specified by the arguments.
6
You are not authorized to read the record. You specified a unique key in the SELECT request; the record exists, but you do not have authority to read it.
8
The request was not successful. An error message has been written to the message log data set. This can occur if more than one record in the database satisfies the field values specified by your arguments. For example, you want to select an application description record with the ID APPL1, and there are two such application descriptions in the database with different validity dates. Your arguments must specify both the application ID and the valid-from date to uniquely identify the record.