Index example: Ordering with ALWCPYDTA(*OPTIMIZE) and a unique-weight sort sequence table

 

Ordering with ALWCPYDTA(*OPTIMIZE) and a unique-weight sort sequence table (SRTSEQ(*LANGIDUNQ) LANGID(ENU)).

  SELECT * FROM STAFF    WHERE JOB = 'MGR'
   ORDER BY JOB

When using the OPNQRYF command, specify:

OPNQRYF FILE((STAFF))
   QRYSLT('JOB *EQ ''MGR''') 
   KEYFLD(JOB) 
   SRTSEQ(*LANGIDUNQ) LANGID(ENU)
   ALWCPYDTA(*OPTIMIZE)

The system can use either index HEXIX or index UNQIX for selection. Ordering is done during the sort using the *LANGIDUNQ sort sequence table.

 

Parent topic:

Examples of indexes