# CHECKSUM

Updated: 10/14/2021, 2:20:00 PM
Created: 10/14/2021, 2:20:00 PM
Last Updated By: mikes
Read Time: 1 minute(s)

# Description

The CHECKSUM function returns a simple numeric checksum of a character string. It takes the general form:

CHECKSUM(expression)
1

Where:

expression may evaluate to any result but will usually be a string.

The function scans every character in expression and returns a numeric addition of the characters within expression. This is done by calculating the checksum by summing the product of the ASCII value of each character and its position within the string.

An example of use is as:

INPUT DataBlock,128:
IF CHECKSUM(DataBlock) = ExpectedChk THEN
    CRT AckChar:
END
ELSE
......

1
2
3
4
5
6
7

Go back to jBASE BASIC

Go back to Programmers' Reference Guide