The TEST-NUMVAL Function

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

The type of the function is integer.

General Format


  1. argument-1 must be an alphanumeric or national literal, or a data item of class type alphanumeric or national.

Returned Values

  1. If the value of argument-1 adheres to the rules specified by the NUMVAL 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.