ILE COBOL Language Reference


NUMVAL

The NUMVAL function returns the numeric value represented by the alphanumeric character string specified in an argument. The function strips away any leading or trailing blanks in the string, producing a numeric value that can be used in an arithmetic expression.

The function type is numeric.

Format
 
>>-FUNCTION NUMVAL--(argument-1)-------------------------------><
 
 
argument-1
Must be a nonnumeric literal or an alphanumeric data item whose content has the following formats:
>>-+-------+--+----+--+-------+--+-digit--+--------------+-+---->
   '-space-'  +-+--+  '-space-'  |        '-.--+-------+-' |
              '- --'             |             '-digit-'   |
                                 '-.--digit----------------'
 
>--+-------+---------------------------------------------------><
   '-space-'
 
 
>>-+-------+--+-digit--+--------------+-+--+-------+--+----+---->
   '-space-'  |        '-.--+-------+-' |  '-space-'  +-+--+
              |             '-digit-'   |             +- --+
              '-.--digit----------------'             +-CR-+
                                                      '-DB-'
 
>--+-------+---------------------------------------------------><
   '-space-'
 
 
space
A string of one or more spaces.
digit
A string of one or more digits. The total number of digits must not exceed 18.

If the DECIMAL-POINT IS COMMA clause is specified in the SPECIAL-NAMES paragraph, a comma must be used in argument-1 rather than a decimal point.

The returned value is an approximation of the numeric value represented by argument-1.

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]