The Query Process


A query process allows you to:

·    Select a subset of data from a file by providing (or having a user provide) selection criteria.

·    Sort the selected data by specifying (or having the user specify) one or more sort fields.

You frequently use a query process in conjunction with an output process (described later), to produce a predefined report format for the data as selected and sorted in the query. You can also use a query before an update process to select subsets of a file to be processed in a prescribed sequence.

Included in the general information you specify about a query is the name of the PCF (process control file) and the key you want to use to access the file (if other than the primary key).

In specifying the selection criteria for a query, you can identify as many field constraints as you wish for both key and non-key fields. Each constraint allows you to specify a relation (such as equal to or greater than) between fields, or between a field and a constant. There is also an includes relation that you can use to constrain records by the presence of words or word strings in text. Note that these selections are case-sensitive.

The Record Selection screen also provides an area that allows you to combine several individual constraints into logical expressions, including parentheses, ANDs, and ORs. As a designer, you can predefine some or all of the selection constraints, or you can allow a user to specify the constraints dynamically at runtime.

As with the selection criteria, you can choose to sort a file by any number of key or non-key fields. You can predefine any or all of the sort criteria, and allow end users to modify sort requirements dynamically. Each sort field is potentially a “control break/subtotal” level in an output, and you or a user can specify print-related information about each sort field, such as whether to print subheadings or go to the top of a new page.

Refer to Chapter 3-9: Query Processes for detailed specifications on defining these processes.