COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Example 206 NUMVAL-C Function
Code:
DATA DIVISION
WORKING-STORAGE SECTION.
01 A PICTURE S99V99.
PROCEDURE DIVISION.
MOVE FUNCTION NUMVAL-C ("35") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C ("$35") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C ("35$") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C ("35.75") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C (".35") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C (" - 35.75 ") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL-C (" 35.75 CR") TO A.
DISPLAY A.
Output:
35.00
35.00
35.00
35.75
00.35
-35.75
-35.75
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.
Example 207 ORD Function
Code:
DISPLAY FUNCTION ORD ("A")
DISPLAY FUNCTION ORD ("b")
DISPLAY FUNCTION ORD ("3")
DISPLAY FUNCTION ORD ("%")
Output:
066
099
052
038
ORD-MAX Function
ORD-MAX, an integer function, returns the ordinal number of its maximum argument.
682 Intrinsic Functions