COLLSEQ

COLLSEQ specifies the collating sequence for comparison of alphanumeric and DBCS operands.

COLLSEQ option syntax

Read syntax diagramSkip visual syntax diagramCOLLSEQ(BINARYLOCALEEBCDIC)

Default is: COLLSEQ(BINARY)

Abbreviations are: CS(L|E|BIN|B)

You can specify the following suboptions for COLLSEQ:

  • COLLSEQ(EBCDIC): Use the EBCDIC collating sequence rather than the ASCII collating sequence.
  • COLLSEQ(LOCALE): Use locale-based collation (consistent with the cultural conventions for collation for the locale).
  • COLLSEQ(BIN): Use the hexadecimal values of the characters; the locale setting has no effect. This setting will give better runtime performance.

If you use the PROGRAM COLLATING SEQUENCE clause in your source with an alphabet-name of STANDARD-1, STANDARD-2, or EBCDIC, the COLLSEQ option is ignored for comparison of alphanumeric operands. If you specify PROGRAM COLLATING SEQUENCE is NATIVE, the COLLSEQ option applies. Otherwise, when the alphabet-name specified in the PROGRAM COLLATING SEQUENCE clause is defined with literals, the collating sequence used is that given by the COLLSEQ option, modified by the user-defined sequence given by the alphabet-name. (For details, see the related reference about the ALPHABET clause.)

The PROGRAM COLLATING SEQUENCE clause has no effect on DBCS comparisons.

The former suboption NATIVE is deprecated. If you specify the NATIVE suboption, COLLSEQ(LOCALE) is assumed.

The following table summarizes the conversion and the collating sequence that are applicable, based on the types of data (ASCII or EBCDIC) used in a comparison and the COLLSEQ option in effect when the PROGRAM COLLATING SEQUENCE clause is not specified. If it is specified, the source specification has precedence over the compiler option specification. The CHAR option affects whether data is ASCII or EBCDIC.

Table 1. Effect of comparand data type and collating sequence on comparisons
Comparands COLLSEQ(BIN) COLLSEQ(LOCALE) COLLSEQ(EBCDIC)
Both ASCII No conversion is performed. The comparison is based on the binary value (ASCII). No conversion is performed. The comparison is based on the current locale. Both comparands are converted to EBCDIC. The comparison is based on the binary value (EBCDIC).
Mixed ASCII and EBCDIC The EBCDIC comparand is converted to ASCII. The comparison is based on the binary value (ASCII). The EBCDIC comparand is converted to ASCII. The comparison is based on the current locale. The ASCII comparand is converted to EBCDIC. The comparison is based on the binary value (EBCDIC).
Both EBCDIC No conversion is performed. The comparison is based on the binary value (EBCDIC). The comparands are converted to ASCII. The comparison is based on the current locale. No conversion is performed. The comparison is based on the binary value (EBCDIC).

Related references  
CHAR
ALPHABET clause (COBOL for Linux® on x86 Language Reference)