sysLib.calculateChkDigitMod11(
text CHAR | NUM inOut,
checkLength INT in,
result SMALLINT inOut)
The following example uses sysLib.calculateChkDigitMod11 to verify that an account number was transmitted accurately.
program CheckDigit11 type BasicProgram
acctNo CHAR(10) = "56621869";
len SMALLINT = 8;
result SMALLINT = 0;
function main()
sysLib.calculateChkDigitMod11 (acctNo, len, result);
if (result != 0)
sysLib.writeStdout("Check digit not created");
end
sysLib.writeStdout(acctNo);
// acctNo is 56621865
end // main
end // program
6 x 2 = 12
8 x 3 = 24
1 x 4 = 4
2 x 5 = 10
6 x 6 = 36
6 x 7 = 42
5 x 2 = 10
(12 + 24 + 4 + 10 + 36 + 42 + 10) / 11
= 138 / 11
= 12 remainder 6
11 - 6 = 5
If the remainder is 0 or 1, the check digit is 0.
56621865
| Platform | Issue |
|---|---|
| JavaScript generation | The function sysLib.calculateChkDigitMod11() is not supported |