SCMP function

Syntax

SCMP (string.number.1, string.number.2)

Description

Use the SCMP function to compare two string numbers and return one of the following three numbers: -1 (less than), 0 (equal), or 1 (greater than). If string.number.1 is less than string.number.2, the result is -1. If they are equal, the result is 0. If string.number.1 is greater than string.number.2, the result is 1. You can use this function in any expression where a string or string number is valid.

Either string number can be a valid number or string number. Computation is faster with string numbers.

If either string number contains nonnumeric data, an error message is generated and 0 is used instead of the nonnumeric data. If either string number evaluates to the empty string, null is returned.

Example

X = "123456789"
Y = "123456789"
IF SCMP(X,Y) = 0 THEN PRINT "X is equal to Y"
   ELSE PRINT "X is not equal to Y"
END

This is the program output:

X is equal to Y