DURING INPUT TWO KINDS OF ERROR ARE VERY COMMON
i. TRANSACTION ERROR ii. TRANSPOSITION ERROR DETECTED USIN CHECK DIGIT,
--A CHECK DIGIT IS AN ADDITIONAL CHARACTER(MOSTLY A DIGIT) IS INTRODUCED INTO THE INPUT DATA.
*BOTH THESE ERRORS CAN BE DECTECTED
Example: find the check digit for the number 036532
0
|
3
|
6
|
5
|
3
|
2
|
x7
|
x6
|
x5
|
x4
|
x3
|
x2
|
0
|
18
|
30
|
20
|
9
|
4
|
81/11 = 7 remainder 4
11 - 4 = 7
7 is therefore the check digit.
PROBLEMS: If the remainder from the division is 0 or 1, then the subtraction will yield a two digit number of either 10 or 11. This won't work, so if the check digit is 10, then X is frequently used as the check digit and if the check digit is 11 then 0 is used as the check digit. If X is used, then the field for the check digit has to be defined as character (PIC X) or there will be a numeric problem.
Steps to verify if the check digit is included as part of the number:- The entire number is multiplied by the same weights that were used to calculate and the check digit itself is multiplied by 1.
- The results of the multiplication are added together.
- The sum is divided by 11 and if the remainder is 0, the number is correct.
PROBLEM: Note that if the check digit is X then 10 is used in the multiplication. Code for this occurrence must be included.
Example of verifying the number 0365327 where 7 is the calculated MOD11 check digit:
0
|
3
|
6
|
5
|
3
|
2
|
7
|
x7
|
x6
|
x5
|
x4
|
x3
|
x2
|
x1
|
0
|
18
|
30
|
20
|
9
|
4
|
7
|
88/11 is 8 remainder 0
Since the remainder from this calculation is 0, the check digit 7 is valid.