The sysLib.calculateChkDigitMod10() system function places a modulus-10 check digit in a NUM variable or a character variable that begins with a series of numeric characters.
sysLib.calculateChkDigitMod10(
text CHAR | NUM inOut,
checkLength INT in,
result SMALLINT inOut)
program CheckDigit10 type BasicProgram
acctNo CHAR(10) = "1734289";
len SMALLINT = 7;
result SMALLINT = 0;
function main()
sysLib.calculateChkDigitMod10 (acctNo, len, result);
if (result != 0)
sysLib.writeStdout("Check digit not created");
end
sysLib.writeStdout(acctNo);
// acctNo is now 1734284
end // main
end // program
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.
1734284
| Platform | Issue |
|---|---|
| JavaScript generation | The function sysLib.calculateChkDigitMod10() is not supported |