Evaluating single characters for collating sequence

To find out the ordinal position of a given alphabetic or alphanumeric character in the collating sequence, use the ORD function with the character as the argument. ORD returns an integer that represents that ordinal position.

About this task

You can use a one-character substring of a data item as the argument to ORD:


IF Function Ord(Customer-record(1:1)) IS > 194 THEN . . .

If you know the ordinal position in the collating sequence of a character, and want to find the character that it corresponds to, use the CHAR function with the integer ordinal position as the argument. CHAR returns the required character. For example:


INITIALIZE Customer-Name REPLACING ALPHABETIC BY Function Char(65)

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