TEST-NUMVAL-F

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

The function type is integer.

Format

Read syntax diagramSkip visual syntax diagramFUNCTION TEST-NUMVAL-F (argument-1 )
argument-1
Must be an alphanumeric literal, a national literal, or a data item of class alphanumeric or class national.
The returned value is as follows:
  • If the content of argument-1 conforms to the argument rules for the NUMVAL-F function, the returned value is 0.
  • If one or more characters are in error, the returned value is the position of the first character in error.
    Notes:
    • If one or more spaces are embedded within a string of numeric characters, 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.
    • If the ARITH(COMPAT) compiler option is in effect, the returned value is the position of the 19th digit if no prior error is found, because the character in error for an argument that is greater than 18 digits is the 19th digit.
    • If the ARITH(EXTEND) compiler option is in effect, the returned value is the position of the 32nd digit if no prior error is found, because the character in error for an argument that is greater than 31 digits is the 32nd digit.
    • If the exponent value in the argument contains more than four significant digits, the returned value is the position of the fifth digit of the exponent.
  • Otherwise, the returned value is (FUNCTION LENGTH (argument-1) + 1).
    These errors include, but are not limited to:
    • argument-1 is zero-length.
    • argument-1 contains only spaces.
    • argument-1 contains valid characters but is incomplete, such as the string ' +.'.