COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
is S9(n)V9(n-1), where n is the number of characters. Any size greater than 9 characters results
in an equivalent PICTURE of S9(19)V9(18). This is a special internal item that cannot be expressed
by the user. Using it is inefficient, so it is best to avoid using a string that is longer than 9 characters.
If the NUMVAL function is moved to an alphanumeric item, the results might not be what is expected
because of the implied PICTURE described previously. For string sizes greater than 10, the result
is changed to S9(18).
Example 205 NUMVAL Function
Code:
DATA DIVISION
WORKING-STORAGE SECTION.
01 A PICTURE S99V99.
PROCEDURE DIVISION.
MOVE FUNCTION NUMVAL ("35") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL ("35.") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL ("35.75") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL (".35") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL (" - 35.75 ") TO A.
DISPLAY A.
MOVE FUNCTION NUMVAL (" 35.75 CR") TO A.
DISPLAY A.
Output:
35.00
35.00
35.75
00.35
-35.75
-35.75
NUMVAL-C Function
NUMVAL-C, a numeric function, returns the numeric value of a specified character-string, ignoring
any currency sign or commas preceding the decimal point.
value-1
680 Intrinsic Functions










