ISO2002ENTMF 

The TEST-NUMVAL-C Function

The TEST-NUMVAL-C function verifies that the contents of argument-1 adheres to the specification for the NUMVAL-C function.

The type of the function is integer.

General Format

FUNCTION TEST-NUMVAL-C (argument-1 [argument-2])

Arguments

  1. argument-1 must be an alphanumeric or national literal, or a data item of class type alphanumeric or national. it must conform to one of the following formats:

    Format 1:

    >>-.-------.--.-----.--.-------.--.----.--.-------.-------------->
       +-space-+  +- + -+  +-space-+  +-cs-+  +-space-+
                  +- - -+
    
    >--.-digit--.---------------.--.--------------.-.--.-------.-----><
       |        | +----------+  |  +-.--.-------.-+ |  +-space-+
       |        | V          |  |       +-digit +   |
       |        +-.-,--digit-.--+                   |
       +-.--digit-----------------------------------+

    Format 2:

    >>-.-------.--.----.--.-------.---------->
       +-space-+  +-cs-+  +-space-+
    
    >--.-digit--.---------------.--.--------------.-.--.-------.----->
       |        | +----------+  |  +-.--.-------.-+ |  +-space-+
       |        | V          |  |       +-digit-+   |
       |        +-.-,--digit-.--+                   |
       +-.--digit-----------------------------------+
    
    >--.-----.--.-------.--------------------------------------------><
       +- + -+  +-space-+
       +- - -+
       +--CR-+
       +--DB-+

    where:

    space
    A string of one or more spaces.
    cs
    The currency sign - a string of one or more characters. argument-1 can only contain one currency sign.
    digit
    A string of one or more digits. If the DECIMAL-POINT IS COMMA clause is specified in the SPECIAL-NAMES paragraph, the functions of the comma and the decimal point are reversed.
  2. argument-2 is the string representing the currency value.
  3. argument-2 must conform to the following rules:
    • It must be specified if the program contains more than one CURRENCY SIGN clause.
    • It must be of the same class as argument-1.
    • It must not contain any of the following: 0-9, leading or trailing spaces, any of the special characters '+','-','.',','.
    • It can be any length from 0 to that allowable for an elementary or group data item of the class of argument-2.
    • It is case sensitive when a match is attempted.

Returned Values

  1. If the value of argument-1 adheres to the rules specified by the NUMVAL-C function, the value 0 is returned.
  2. If one or more characters in argument-1 do not adhere to the specification, the value of the first character in error is returned.
    Note: If a string of numeric characters contains one or more spaces, the returned value is the position of the first non-space character following the spaces, because one or more spaces following one or more digits is valid. For example, if argument-1 is '0 1', the returned value will be 3.
  3. If neither of these states are true, the returned value is (FUNCTION LENGTH (argument-1) +1). Such circumstances that could cause this value are:
    • argument-1 is zero-length.
    • argument-1 contains only spaces.
    • argument-1 contains valid characters but is incomplete.