ALPHABET clause
The ALPHABET clause provides a means of relating an alphabet-name to a specified character code set or collating sequence.
The related character code set or collating sequence can be used for alphanumeric data, but not for DBCS or national data.
- ALPHABET alphabet-name-1 IS
- alphabet-name-1 specifies a collating sequence when
used in:
- The PROGRAM COLLATING SEQUENCE clause of the object-computer paragraph
- The COLLATING SEQUENCE phrase of the SORT or MERGE statement
alphabet-name-1 specifies a character code set when used in:
- The FD entry CODE-SET clause
- The SYMBOLIC CHARACTERS clause
- STANDARD-1
- Specifies the ASCII character set.
- STANDARD-2
- Specifies the International Reference Version of ISO/IEC 646, 7-bit coded character set for information interchange.
- NATIVE
- Specifies the native character code set. If the ALPHABET clause is omitted, EBCDIC is assumed.
- EBCDIC
- Specifies the EBCDIC character set.
- literal-1 , literal-2 , literal-3
- Specifies that the collating
sequence for alphanumeric data is
determined by the program, according to the following rules:
- The order in which literals appear specifies the ordinal number, in ascending sequence, of the characters in this collating sequence.
- Each numeric literal specified must be an unsigned integer.
- Each
numeric literal must have a value that corresponds to a valid
ordinal position within the collating sequence in effect.
See EBCDIC and ASCII collating sequences for the ordinal numbers for characters in the single-byte EBCDIC and ASCII collating sequences.
- Each character in an alphanumeric literal represents that actual character in the character set. (If the alphanumeric literal contains more than one character, each character, starting with the leftmost, is assigned a successively ascending position within this collating sequence.)
- Any characters that are not explicitly specified assume positions in this collating sequence higher than any of the explicitly specified characters.
- Within one alphabet-name clause, a given character must not be specified more than once.
- Each alphanumeric literal associated with a THROUGH or ALSO phrase must be one character in length.
- When the THROUGH phrase
is specified, the contiguous characters
in the native character set 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 can be either ascending or descending within the original native character set. That is, if "Z" THROUGH "A" is specified, the ascending values, left-to-right, for the uppercase letters are:
ZYXWVUTSRQPONMLKJIHGFEDCBA
- When the ALSO phrase is specified, the characters
specified as literal-1, literal-3,
... 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.
- When the ALSO phrase is specified and alphabet-name-1 is referenced in a SYMBOLIC CHARACTERS clause, only literal-1 is used to represent the character in the character set.
- The character that has 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 any characters are not explicitly specified) is considered to be the HIGH-VALUE character for procedural statements such as DISPLAY and as the sending field in a MOVE statement. (If the ALSO phrase example given above were specified as the high-order characters of this collating sequence, the HIGH-VALUE character would be %.)
- The character that has 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).
literal-1, literal-2, and literal-3 must be alphanumeric or numeric literals. All must have the same category. A floating-point literal, a national literal, a DBCS literal, or a symbolic-character figurative constant must not be specified.