The system function SysLib.verifyChkDigitMod10 verifies a modulus-10 check digit in a character item that begins with a series of integers.
SysLib.verifyChkDigitMod10( text anyChar in, checkLength SMALLINT in, result SMALLINT inOut)
This item has 4 digits and is either of type SMALLINT or is of a type BIN, with no decimal places.
You can use SysLib.verifyChkDigitMod10 in a function-invocation statement; or as an item validator in a text form.
SysLib.verifyChkDigitMod10 (myInput, myLength, myResult);
An algorithm is used to derive the modulus-10 check digit, and in all cases the number at the check-digit position is not considered; but when the algorithm is complete, the calculated value is compared with the number at the check-digit position.
8 x 2 = 16 4 x 2 = 8 7 x 2 = 14
1 + 6 + 8 + 1 + 4 + 1 + 3 + 2 = 26
30 - 26 = 4
If the subtraction yields 10, the check digit is 0.
In this example, the calculated check digit matches the value in the check-digit position, and the value of myResult is 0.
Related reference
EGL library SysLib
Validation properties