CHECKSUM Function

Returns a number equal to the checksum of the specified string.

Syntax

CHECKSUM(expression)

Syntax Elements

expression is any valid DataBasic expression or any string, substring, or value; expressed as a variable name, a value, or a string enclosed in quotes.

Algorithm

The system calculates the checksum by summing the results of multiplying each character value by its position in the string. Thus, the checksum of the string "ABC" would be:

65 * 1 + 66 * 2 + 67 * 3 = 398

Examples

CKSUM = CHECKSUM("123")

Returns the checksum of string 123.

Y = CHECKSUM(X)
PRINT Y

Prints the checksum of string X.