HP RPG/iX Utilities Reference Manual (30318-90006)

C- 307
K Appendix C Calculating the Self-Check
Digit
Introduction
As described in chapter 2, the self-check digit is used for numeric fields. If a mode of self-checking is
specified, the field is checked by the checking algorithm when information is entered.
Modulus 10 Self-Check Digit
To calculate the modulus 10 self-check digit, follow these steps:
1 Multiply the rightmost position and every other position, moving to the left, of the number by 2.
Example: If your number is 1 2 3 4 5 6 7, multiply the digits 7, 5, 3, and 1 by 2 to get the numbers
14, 10, 6, and 2.
2 Add the digits of the products obtained from step 1 above to the digits that were not multiplied.
Example: The products obtained from step 1 above are 14, 10, 6, and 2; the digits that were not
multiplied are 2, 4, and 6. Add all these digits: 1 + 4 + 1 + 0 + 6 + 2 + 2 + 4 + 6 = 26.
3 Subtract the value obtained in step 2 from the next higher multiple of 10; the result is the self-
check digit.
Example: The next higher multiple of 10 from the result 26 obtained in step 2 above is 30. Sub-
tracting 26 from 30 gives the result of 4, which is the self-check digit.
4 The check digit is then appended to the right end of the number to create the final result.
Modulus 11 Self-Check Digit
To calculate the modulus 11 self-check digit, follow these steps:
1 Assign a multiplication factor to each digit position of your number as follows: starting with the
rightmost position of your number, assign the numbers 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2,...from right
to left.
Example: If your number is 1 2 3 4 5 6 7, the multiplication factor is assigned as follows:
Your number: 1 2 3 4 5 6 7
Multiplication factor: 2 7 6 5 4 3 2
2 Multiply each digit by its multiplication factor.
Example:
Your number: 1 2 3 4 5 6 7
Multiplication factor: 2 7 6 5 4 3 2
Results after multiplying: 2 14 18 20 20 18 14
3 Add the products from the multiplication.