verifyChkDigitMod10()
The sysLib.verifyChkDigitMod10() system function verifies a modulus-10 check digit in a NUM variable or a character variable that begins with a series of numeric characters.
Syntax
sysLib.verifyChkDigitMod10(
text CHAR | NUM in,
checkLength INT in,
result SMALLINT inOut)
- text
- A NUM variable or a CHAR variable that begins with a series of numeric characters. The variable must include an additional position for the check digit, which goes immediately to the right of the other characters.
- checkLength
- An INT variable that contains the number of characters to verify from the text parameter, including the position of the check digit. For NUM variables that are passed as the text parameter, leading zeros count, so in most cases, checkLength will be equal to the length of the NUM variable.
- result
- A SMALLINT variable that receives one of two values:
- 0
- The calculated check digit matches the value in text.
- 1
- The calculated check digit does not match the value in text.
Example
The following example shows a check digit in an account number.
program VerifyDigit10 type BasicProgram
acctNo CHAR(10) = "1734289"; // 9 is check digit
len SMALLINT = 7;
result SMALLINT = 0;
function main()
sysLib.verifyChkDigitMod10 (acctNo, len, result);
if (result != 0)
sysLib.writeStdout("Check digit not correct");
end
end // main
end // program
For more information about the algorithm used to calculate the value of the check digit, see calculateChkDigitMod10().
Compatibility considerations
| Platform | Issue |
|---|---|
| JavaScript™ generation | The function sysLib.verifyChkDigitMod10() is not supported |