
TEST-NUMVAL-C
The TEST-NUMVAL-C function verifies that the contents of argument-1 conform to the specification for argument-1 of the NUMVAL-C function.
The function type is integer.
- argument-1
- Must be an alphanumeric literal, a national literal,
or a data item of class alphanumeric or class national that contains
a character string in either of the following formats:
- space
- A string of one or more spaces.
- cs
- The string of one or more characters that form the currency sign. At most one copy of the characters specified by cs can occur in argument-1.
- 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 decimal point in argument-1 are reversed.
- argument-2
- Specifies the currency string value.
The following rules apply:
- argument-2 must be specified if the program contains more than one CURRENCY SIGN clause.
- argument-2, if specified, must be of the same class as argument-1.
- argument-2 must not contain any of the digits 0 through 9, any leading or trailing spaces, or any of the special characters '+', '-', '.', or ','.
- argument-2 can be of any length valid for an elementary or group data item of the class of argument-2, including zero.
- Matching of argument-2 is case sensitive. For example, if you specify argument-2 as 'CHF', it will not match 'ChF', 'chf' or 'chF'.
If argument-2 is not specified, the character used for cs is the currency symbol specified for the program.
The returned value is as follows:
- If the content of argument-1 conforms to the argument rules for the NUMVAL-C 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.
- 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 ' +.'.
