verifyChkDigitMod11()

The sysLib.verifyChkDigitMod11() system function verifies a modulus-11 check digit in a NUM variable or a character string that begins with a series of numeric characters.

Syntax

  sysLib.verifyChkDigitMod11(
    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 an account number that includes a check digit.

program VerifyDigit11 type BasicProgram
  acctNo CHAR(10) = "56621869";  // 9 is check digit 
  len SMALLINT = 8;
  result SMALLINT = 0;   
  
  function main()
    sysLib.verifyChkDigitMod11 (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 calculateChkDigitMod11().

Compatibility considerations

Table 1. Compatibility considerations
Platform Issue
JavaScript generation The function sysLib.verifyChkDigitMod11() is not supported.

Feedback