COBOL Manual for TNS and TNS/R Programs

Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs522555-006
14-43
ORD Function
ORD Function
ORD, an integer function, returns the ordinal number of its argument in the program
collating sequence.
argument
is a one-character alphabetic or alphanumeric argument.
The returned value is the ordinal number of argument in the program collating
sequence. It is at least one.
ORD-MAX Function
ORD-MAX, an integer function, returns the ordinal number of its maximum argument.
argument
is an alphabetic, alphanumeric, integer, or numeric argument. If you specify more
than one argument, they must all be of the same class. Integer and numeric
arguments can be mixed, because integers are of the class numeric.
argument can be an array; for example,
FUNCTION ORD-MAX (ARRAY1(ALL))
returns the ordinal number of the largest element of the array ARRAY1.
Example 14-29. ORD Function
Code:
DISPLAY FUNCTION ORD ("A")
DISPLAY FUNCTION ORD ("b")
DISPLAY FUNCTION ORD ("3")
DISPLAY FUNCTION ORD ("%")
Output:
066
099
052
038
( )
ORDFUNCTION argument
VST452.vsd
( )
ORD-MAXFUNCTION argument
VST435.vsd