ALPHABET Clause

The ALPHABET clause provides a means of relating an alphabet-name to a specified character code set or collating sequence.

Read syntax diagramSkip visual syntax diagram
ALPHABET Clause - Format

>>-ALPHABET--alphabet-name-1--+----+---------------------------->
                              '-IS-'   

>--+-STANDARD-1--------------------------------+---------------><
   +-STANDARD-2--------------------------------+   
   +-NATIVE------------------------------------+   
   +-EBCDIC------------------------------------+   
   |         (1)                               |   
   +-NLSSORT-----------------------------------+   
   | .---------------------------------------. |   
   | V                                       | |   
   '---literal-1--+------------------------+-+-'   
                  +-+-THROUGH-+--literal-2-+       
                  | '-THRU----'            |       
                  | .-----------------.    |       
                  | V                 |    |       
                  '---ALSO--literal-3-+----'       

Notes:
  1. IBM® Extension
It specifies a collating sequence when used in either:
It specifies a character code set when specified in
Note: The EBCDIC collating sequence is used when the alphabet-name clause is omitted.
Related Information:
alphabet-name-1
Alphabet-name-1 follows the rules for user-defined names. At least one character must be alphabetic. Alphabet-name-1 identifies a specific character code set or collating sequence.
STANDARD-1
Specifies the ASCII character set.
STANDARD-2
Specifies the International Reference Version of the ISO 7-bit code defined in International Standard 646, 7-bit Coded Character Set for Information Processing Interchange.
NATIVE
Specifies the EBCDIC character set.
EBCDIC
Specifies the EBCDIC character set.
NLSSORT
Use the SRTSEQ and LANGID specifications in the compiler options (or implied defaults) for alternate collating sequence aspects of the alphabet-name. An alphabet-name associated with NLSSORT can be referred to only in the PROGRAM COLLATING SEQUENCE clause or in the COLLATING SEQUENCE phrase of the SORT and MERGE statements.
literal-1, literal-2, literal-3
Specifies that the collating sequence is to be determined by the program, according to the following rules:
  • The order in which literals appear specifies the ordinal number, in ascending sequence, of the character(s) in this collating sequence.
  • Each numeric literal specified must be an unsigned integer and must have a value from 1 through 256 (the maximum number of characters in the EBCDIC character set). The value of each literal specifies the relative position of a character within the EBCDIC character set. For example:
    • literal 112 represents the EBCDIC character ?
    • literal 234 represents the EBCDIC character Z
    • literal 241 represents the EBCDIC numeric character 0.

    Appendix C. EBCDIC and ASCII Collating Sequences, lists the ordinal number for each character in the EBCDIC and ASCII collating sequences.

  • Each character in a nonnumeric literal represents that actual character in the EBCDIC character set. (If the nonnumeric literal contains more than one character, each character, starting with the leftmost, is assigned a successively ascending position within this collating sequence.)
  • Any EBCDIC characters not explicitly specified assume positions in this collating sequence higher than any of the explicitly specified characters. The relative order of the unspecified characters remains unchanged from the EBCDIC collating sequence.
  • Within one alphabet-name clause, a given character must not be specified more than once.
  • Each nonnumeric literal associated with a THROUGH or ALSO phrase must be 1 character in length (if it is longer, only the first character is kept, and a warning is issued)
  • When the THROUGH phrase is specified, the contiguous EBCDIC characters beginning with the character specified by literal-1 and ending with the character specified by literal-2 are assigned successively ascending positions in this collating sequence. This sequence may be either ascending or descending within the original EBCDIC sequence. For example, if the characters Z through S are specified, then for this collating sequence the ascending values are: ZYXWVUTS.
  • When the ALSO phrase is specified, the EBCDIC characters specified as literal-1, literal-3, and so on, are assigned to the same position in this collating sequence. For example, if you specify:
    "D" ALSO "N" ALSO "%"
    the characters D, N, and % are all considered to be in the same position in the collating sequence.
  • If specified as literals in the SPECIAL-NAMES paragraph, the figurative constants HIGH-VALUE and LOW-VALUE are associated with hex FF and hex 00 respectively.
  • After all clauses in the SPECIAL-NAMES paragraph are processed, the character having the highest ordinal position in this collating sequence is associated with the figurative constant HIGH-VALUE. If more than one character has the highest position, because of specification of the ALSO phrase, the last character specified (or defaulted to when some characters in the native collating sequence are not explicitly specified) is considered to be the HIGH-VALUE character for procedural statements such as DISPLAY, or as the sending field in a MOVE statement. (If all characters within the native collating sequence were explicitly specified, and the ALSO phrase example from above were specified as the high-order characters of this collating sequence, the HIGH-VALUE character would be %.)
  • After all clauses in the SPECIAL-NAMES paragraph are processed, the character having the lowest ordinal position in this collating sequence is associated with the figurative constant LOW-VALUE. If more than one character has the lowest position, because of specification of the ALSO phrase, the first character specified is the LOW-VALUE character. (If the ALSO phrase example given above were specified as the low-order characters of the collating sequence, the LOW-VALUE character would be D.)

When literal-1, literal-2, or literal-3 is specified, the alphabet-name must not be referred to in a CODE-SET clause (see CODE-SET Clause).

IBM Extension

DBCS literals and floating-point literals may not be used in a user-specified collating sequence.

End of IBM Extension