ALTSEQ (Alternative Collating Sequence) keyword for physical and logical files

You can use this file-level keyword to direct the operating system to use an alternative collating sequence table when the system sequences the records of a file member for retrieval, if you specified a key for this file.

The format of the keyword is:
ALTSEQ([library-name/]table-name)

The name of the alternative collating sequence table is a required parameter value. The library-name is optional. If you do not specify the library-name, the IBM® i operating system uses the library list (*LIBL) at file creation time.

The ALTSEQ keyword is not valid under the following conditions:
  • When you specify FILETYPE(*SRC) on the Create Physical File (CRTPF) or Create Logical File (CRTLF) command.
  • When key fields have a data type of packed decimal, binary, or floating-point.
  • When key fields are specified with ABSVAL or SIGNED. For those fields, NOALTSEQ (a key field-level keyword) is assumed and does not need to be specified. You can specify NOALTSEQ for any field in a composite key that does not require the alternative sequence.
  • When you specify a value other than *SRC on the SRTSEQ parameter on the Create Physical File (CRTPF) or Create Logical File (CRTLF) command.

The ALTSEQ keyword cannot be specified with the REFACCPTH keyword.

You must have use authority to the alternative collating sequence table. The alternative collating sequence table is created using the Create Table (CRTTBL) command.

ALTSEQ causes zoned key fields to default to unsigned sequence. You can override the default by specifying the SIGNED keyword for individual key fields.

Example

The following example shows how to specify the ALTSEQ keyword for a logical file.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      ALTSEQ(TABLELIB/TABLE1)
00020A          R RECORD1                   PFILE (PF1)
00030A             :
00040A             :
00050A             :
00060A            NAME          20
00070A             :
00080A             :
00090A          K NAME
     A

Records with format RECORD1 are sequenced by key NAME according to the alternative collating sequence table (TABLE1 in library TABLELIB).