Index example: Ordering and grouping on the same columns with a shared-weight sort sequence table
Ordering and grouping on the same columns with a shared-weight sort sequence table (SRTSEQ(*LANGIDSHR) LANGID(ENU)).
SELECT JOB, SALARY FROM STAFF GROUP BY JOB, SALARY ORDER BY JOB, SALARYWhen using the OPNQRYF command, specify:
OPNQRYF FILE((STAFF)) FORMAT(FORMAT3) GRPFLD(JOB SALARY) KEYFLD(JOB SALARY) SRTSEQ(*LANGIDSHR) LANGID(ENU)The system can use SHRIX2 to satisfy both the grouping and ordering requirements. If index SHRIX2 did not exist, the system creates an index using a sort sequence table of *LANGIDSHR.
Parent topic:
Examples of indexes