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

Text

Len

Dec

10

D

CRLIMIT

Credit limit amount

7

2

20

A

STATE

State abbreviation

2

 

30

A

LASTNAME

Customer last name

20

 

40

A

INIT

Customer first and middle initial

2

 

___

_

ACCTNUMBER

Account number

6

 

___

_

STREETADDR

Street address

20

 

___

_

CITY

City

15

 

___

_

ZIPCODE

Zip code

5

 

 

 

 

 

Bottom

 

F3=Exit

F5=Report

F11=Display names only

F12=Cancel

 

F13=Layout

F18=Files

F20=Renumber

 

 

Notice that because you left the A/D column blank for the STATE, LASTNAME, and INIT fields, Query replaces the blank with an A to show that ascending order is used.

The sort in this example provides a report that looks something like this:

Account

 

Last

Street

 

 

Zip

Credit

Number

Init

Name

Address

City

State

Code

Limit

-------

----

--------------

--------------

----------

-----

-----

-------

938485

CA

Johnson

101 2nd St.

Montvale

GA

30545

9999.00

583990

GF

Abraham

20

Vineview

Elk River

MN

55330

9999.00

693829

NO

Thomas

8256 1st Ave.

Twostone

WY

82609

9999.00

846283

JS

Alison

20749 73rd St.

Ottawa

MN

56342

5000.00

938472

EJ

Henning

1 Oil Lane

Oiltown

TX

75217

5000.00

029384

MA

Brown

904 38th St.

New York

NY

12201

1000.00

397267

OS

Tyron

1039 20th Ave.

Falls

NY

14841

1000.00

475938

MA

Doe

P.O. Box 90834

Reading

CA

95685

700.00

930484

BJ

Hubbard

10

Colusa

Junction

CA

91722

700.00

192837

CE

Lee

98

Elm St.

Falls

NY

14841

700.00

392859

LL

Vine

18940 Main St.

Tombstone

VT

05046

700.00

389572

RS

Stevens

38

Yale Blvd.

Deer Falls

CO

80226

400.00

839283

AC

Jones

1984 5th Ave.

New York

NY

13041

400.00

493264

JS

Jones

P.O. Box 8910

New York

NY

13088

400.00

The highest credit limits (9999.00) are listed first, followed by the next highest. Within each group of credit limits, the records are listed alphabetically by state. Within each group of states, the customers are listed alphabetically by last name (such as Brown and Tyron in New York, and Doe and Hubbard in California). If two or more customers with the same last name live in the same state and have the same credit rating, the order of the records is determined alphabetically by first and middle initials (such as AC Jones and JS Jones in New York).

Additional sort considerations in Query for iSeries

Numeric fields are sorted by arithmetic value.

108Query for iSeries Use V5R2

Page 120
Image 120
IBM SC41-5210-04 manual Additional sort considerations in Query for iSeries