IBM ISERIES SC41-5210-04 User Manual

Page 118

Advertising
background image

Select Sort Fields

Type sort priority (0-999) and A (Ascending) or D (Descending) for

the names of up to 32 fields, press Enter.

Sort

Prty A/D Field

___ _ ACCTNUMBER

30 _ INIT

20 _ LASTNAME

___ _ STREETADDR

___ _ STATE

___ _ CITY

___ _ ZIPCODE

10 D CRLIMIT

Bottom

F3=Exit

F5=Report

F11=Display text

F12=Cancel

F13=Layout

F18=Files

F20=Renumber

F24=More keys

When you press the Enter key after typing your sort priority numbers, Query rearranges the fields on the
display in the following order:
v If fields were selected on the Select and Sequence Fields display, they are listed in the following order:

1. All sort fields (if any) previously selected on this display, in the order specified.

2. Fields selected for the query, but not selected as a sort field. These fields are listed in the order they

were specified on the Select and Sequence Fields display.

v If no fields were selected on the Select and Sequence Fields display, the fields on this display are

shown in the following order:

1. All sort fields (if any) previously selected on this display, in the order specified.

2. Any result fields that have been defined for this query.

3. All other fields, in the order they exist in the record format definitions for the selected files. Fields

from the first file are listed first, followed by those in the second file, and so on.

Query then displays a message

Press Enter to confirm. so that you have a second chance to review

your sort fields and change them if you want.

To remove a sort field from your selections, blank out the number in front of that field name. It is not
necessary to renumber the other fields. To change the priorities of the sort fields, just change the numbers.

If you make any changes, press the Enter key again. The list of field names is rearranged and is shown
with the sort fields first, in the sort priority you specified followed by the remaining fields that were selected
for output. If you want to renumber the fields in added amounts of 10 (10, 20, 30, and so on), press F20.

When you are satisfied that your sort field selections are correct, press the Enter key a final time to end
sort field selection.

The following is an example of how to specify sort priorities.

Assume that you are the credit manager for the United States division of an international mail-order
company, and you want a report of customer names and addresses organized as follows:
v Customers with the highest credit limit should appear first, then the next highest, and so on.
v If two or more customers from the same state have the same credit limit, these customers should be

grouped by state.

106

Query for iSeries Use V5R2

Advertising