IBM i Access sort sequence

You can specify the sort sequence in IBM® i Access functions. When performing queries on the system databases and SQL tables, you can specify the system-supplied or user-supplied sort sequence tables.

Remote SQL support

You can specify the way the selected data has to be sorted when performing the query. For that purpose, sort fields must be specified in the ORDER BY clause. The following clauses also use the specified sort sequence:

  • WHERE clause
  • GROUP BY clause
  • HAVING clause
  • JOIN BY clause
  • UNION clause
  • DISTINCT clause
  • IN predicate
  • LIKE predicate
  • BETWEEN predicate
  • RANGE predicate
  • MAX function
  • MIN function

The actual sort sequence table is retrieved from the job attributes of the user. The SRTSEQ and LANGID parameters can be affected through changing the user profile or changing the job attributes.

Data transfer support

When transferring data from the system to the workstation, you can specify the sort sequence to be applied on selected data. The sort sequence table is also used in the following string comparison operations:

  • WHERE clause
  • GROUP BY clause
  • HAVING clause
  • JOIN BY clause
  • IN predicate
  • LIKE predicate
  • BETWEEN predicate
  • MAX function
  • MIN function

You can specify in the OPTION statement the following parameters related to sort sequence:

  • SRTSEQ (sort sequence table)
    • *JOB
    • *HEX
    • *LANGIDSHR
    • *LANGIDUNQ
    • *LIBL/sort-seq-table-name
    • *CURLIB/sort-seq-table-name
    • library-name/sort-seq-table-name
  • LANGID (language identifier)
    • *JOB
    • language-identifier

You can choose the appropriate sort sequence through options on IBM i Access displays.