This example shows the use of sort sequence and language identifier when you run the Open Query File (OPNQRYF) command to select records.
To see how to use a sort sequence, run the examples in this topic against the STAFF file shown in Table 1.
ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
---|---|---|---|---|---|---|
10 | Sanders | 20 | Mgr | 7 | 18357.50 | 0 |
20 | Pernal | 20 | Sales | 8 | 18171.25 | 612.45 |
30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
40 | OBrien | 38 | Sales | 6 | 18006.00 | 846.55 |
50 | Hanes | 15 | Mgr | 10 | 20659.80 | 0 |
60 | Quigley | 38 | SALES | 00 | 16808.30 | 650.25 |
70 | Rothman | 15 | Sales | 7 | 16502.83 | 1152.00 |
80 | James | 20 | Clerk | 0 | 13504.60 | 128.20 |
90 | Koonitz | 42 | sales | 6 | 18001.75 | 1386.70 |
100 | Plotz | 42 | mgr | 6 | 18352.80 | 0 |
OPNQRYF FILE(STAFF) QRYSLT('JOB *EQ "MGR"')Table 2 shows the record selection with the *HEX sort sequence. The records that match the record selection criteria for the JOB field are selected exactly as specified in the QRYSLT statement; only the uppercase MGR is selected.
ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
---|---|---|---|---|---|---|
30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
Table 3 shows the record selection with the shared-weight sort sequence. The records that match the record selection criteria for the JOB field are selected by treating uppercase and lowercase letters the same. With this sort sequence, mgr, Mgr, and MGR values are selected.
ID | NAME | DEPT | JOB | YEARS | SALARY | COMM |
---|---|---|---|---|---|---|
10 | Sanders | 20 | Mgr | 7 | 18357.50 | 0 |
30 | Merenghi | 38 | MGR | 5 | 17506.75 | 0 |
50 | Hanes | 15 | Mgr | 10 | 20659.80 | 0 |
100 | Plotz | 42 | mgr | 6 | 18352.80 | 0 |
Table 4 shows the record selection with the unique-weight sort sequence. The records that match the record selection criteria for the JOB field are selected by treating uppercase and lowercase letters as unique. With this sort sequence, the mgr, Mgr, and MGR values are all different. The MGR value is selected.