Arrange key fields using the SRTSEQ parameter

You can arrange key fields containing character data according to several sorting sequences available with the SRTSEQ parameter.

Consider the following records.

Record Empname Deptnbr Empnbr
1 Jones, Marilyn 45 23318
2 Smith, Ron 45 41321
3 JOHNSON, JOHN 53 41322
4 Smith, ROBERT 27 56218
5 JONES, MARTIN 53 62213
6 Jones, Martin 08 29231

If the Empname field is the key field and is a character field, the *HEX sequence (the EBCDIC sequence) arranges the records as follows.

Record Empname Deptnbr Empnbr
1 Jones, Marilyn 45 23318
6 Jones, Martin 08 29231
3 JOHNSON, JOHN 53 41322
5 JONES, MARTIN 53 62213
2 Smith, Ron 45 41321
4 Smith, ROBERT 27 56218

Notice that with the *HEX sequence, all lowercase characters are sorted before the uppercase characters. Thus, Smith, Ron sorts before Smith, ROBERT, and JOHNSON, JOHN sorts between the lowercase and uppercase Jones. You can use the *LANGIDSHR sort sequence to sort records when the records were entered using a mixture of uppercase and lowercase. The *LANGIDSHR sequence, which uses the same collating weight for lowercase and uppercase characters, results in the following record.

Record Empname Deptnbr Empnbr
3 JOHNSON, JOHN 53 41322
1 Jones, Marilyn 45 23318
5 JONES, MARTIN 53 62213
6 Jones, Martin 08 29231
4 Smith, ROBERT 27 56218
2 Smith, Ron 45 41321

Notice that with the *LANGIDSHR sequence, the lowercase and uppercase characters are treated as equal. Thus, JONES, MARTIN and Jones, Martin are equal and sort in the same sequence they have in the base file. While this is not incorrect, it would look better in a report if all the lowercase Jones preceded the uppercase JONES. You can use the *LANGIDUNQ sort sequence to sort the records when the records were entered using an inconsistent uppercase and lowercase. The *LANGIDUNQ sequence, which uses different but sequential collating weights for lowercase and uppercase characters, results in the following record.

Record Empname Deptnbr Empnbr
3 JOHNSON, JOHN 53 41322
1 Jones, Marilyn 45 23318
6 Jones, Martin 08 29231
5 JONES, MARTIN 53 62213
4 Smith, ROBERT 27 56218
2 Smith, Ron 45 41321

The *LANGIDSHR and *LANGIDUNQ sort sequences exist for every language supported in your system. The LANGID parameter determines which *LANGIDSHR or *LANGIDUNQ sort sequence to use. Use the SRTSEQ parameter to specify the sort sequence and the LANGID parameter to specify the language.