Previous Topic: $NETWORKID FunctionNext Topic: $NUMERIC Function


$NUMBER Function

$NUMBER returns a numeric value by converting a given alphanumeric value.

This function has the following format:

$NUMBER(name)
name

An identifier of an alphanumeric field or group whose value must consist only of an optional sign (+ or ‑) followed by numerals with one optional decimal point. Leading or trailing blanks are acceptable but are ignored in the input value.

This function is not required since conversion to a numeric format is performed automatically when necessary. However, for program clarity, use this function explicitly.

When numeric conversion is performed automatically, the compiler issues a message that an alphanumeric item is used in a numeric context and that a number‑compatible form is assumed.

Examples

SET X = '‑234.56'
	SET J = $NUMBER (X)  :result is numeric form of ‑234.56

	SET Y = '    ‑123.86
	SET K = $NUMBER (Y)  :result is numeric form of ‑123.86