The algorithm used for the CA Ideal modulo 10 and modulo 11 check‑digit test uses the following logic:
The number to check is assumed to contain the check‑digit in the low order (right‑most) position. The calculation begins with the second digit from the right and proceeds through the high order (left‑most) position. The loop used is:
SET SUM = 0
SET MULTIPLIER = 2
position on first digit
LOOP WHILE digits remain
SET PRODUCT = MULTIPLIER * DIGIT
SET SUM = SUM PRODUCT
IF MULTIPLIER LT 7
SET MULTIPLIER = MULTIPLIER 1
ELSE
SET MULTIPLIER = 2
ENDIF
position on next digit
ENDLOOP
SET REMAINDER = $REMAINDER(SUM,DIV=11)
IF REMAINDER NOT = 0
SET REMAINDER = 11 ‑ REMAINDER
ENDIF
SELECT FIRST ACTION
WHEN REMAINDER EQ 10
not eligible for Modulo‑11 check‑digit test
WHEN CHECK‑DIGIT NOT = REMAINDER
panel field has a check‑digit error
WHEN OTHER
check‑digit is correct
ENDSEL
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|