CHECKSUM() |
|
|
The CHECKSUM() function returns a checksum value for supplied data.
Format
CHECKSUM(data {, mode})
where
The CHECKSUM() function calculates a cyclic redundancy checksum (CRC) value for the supplied data item. Note that the various multivalue products implement this function using different algorithms, not all of which are available in QM. The default algorithm used by QM is a simple rotate and merge but several alternative algorithms used by other software packages are available by use of the optional mode argument.
The checksum value produced by an ECS mode system for data that contains only characters from the 8-bit set is identical to that produced for the same data on a non-ECS mode system. The CRC algorithms are usually based on byte structured data. Applications using ECS mode may sometimes need to use the BSL or BSH conversion code to form a hardware byte order specific representation of the data prior to use of the CHECKSUM() function.
If data is a null string or mode is invalid, the CHECKSUM() function returns zero.
Algorithms
Examples
DISPLAY CHECKSUM(REC)
This statement displays a checksum value for the data in the REC variable using the default algorithm.
DISPLAY CHECKSUM(REC, CRC$CMODEM)
This statement displays a checksum value for the data in the REC variable using the CCITT-XModem algorithm.
See also: |