IBM SC41-5210-04 Server User Manual


 
Chapter 7. Selecting records in Query for iSeries
This chapter describes how you can perform record selection tests so that your query output contains only
selected records, such as records in which the value of a field is equal to a specified value. For example,
you want to obtain information from an employee master file about all employees whose age is equal to or
greater than 21. By using certain tests, you can select only these records from your file (and thus exclude
those who are less than 21).
This selection process involves creating comparison tests that Query uses to select the desired records.
You can specify one test or as many as 100 tests. If the result of the test or the combined result of several
tests is true, the record being tested is selected and included in your query output.
Letting Query for iSeries select records
If you did not type a 1 next to the Select records option on the Define the Query display, all of the records
from your selected files are included in your query output.
The Select Records display is shown during query definition if you typed a 1 next to the Select records
option on the Define the Query display. Press F12 (Cancel) to return to the previous display if you have
changed your mind and now want all records in your output. (Anything you typed on this display is
ignored.)
Selecting the records you want in Query for iSeries
Usually your reports are based on records that have something in common, such as a report that lists only
those items in an inventory that are in short supply. Selecting records by creating comparison tests gives
you the ability to specify that the records must contain (or not contain) particular informationin the case
of the inventory items that are in short supply, you would want in your report only those items for which the
quantity on hand is below a certain level. This type of report is usually more meaningful and easier to use
than a report that contains all of the records from a file.
To select a record, you compare the contents of one or more fields (including result fields) with one or
more specified values to see if a condition, or test, is true. For example, you want all persons with the last
name (LASTNAM) equal to ’Clarke’ to appear in your output.
Test
|
Field | Value
|| |
|| |
LASTNAM EQ ’Clarke’
The Select Records display lists fields you can use (including result fields) and asks you to specify your
comparisons. This display is shown below with some sample fields from a customer master file shown in
the Field column.
© Copyright IBM Corp. 2000, 2002 91