The following table provides examples for using the MOD10 operator. The MOD10 operator validates account numbers, membership numbers, credit card numbers, and checks string lengths using the Modulus 10 algorithm.
Command |
Result |
set B = A MOD10 13 A = # |
# MOD10 13 = # The operation is invalid if either operand contains a # character or none . |
set B = digits MOD10 A A = 20 |
B = # The operation is invalid because operand2 contains a number greater than 16. |
set B = digits MOD10 A A = none |
B = # The operation is invalid. |
set A = digits MOD10 5 digits = 123456 |
123456 MOD10 5 = # The operation is invalid because operand1 contains a digit string that has more digits than what is specified in operand2. |
set A = digits MOD10 5 digits = 1234 |
1234 MOD10 5 = # The operation is invalid because operand1 contains a digit string that has fewer digits than what is specified in operand2. |
set B = A MOD10 13 A = 1234567890128 |
1234567890128 MOD10 13 = 0 (zero) A 0 result means that the tested digits match the specified number of digits and passes the Modulus 10 algorithm. |
set B = A MOD10 13 A = 1234567890123 |
1234567890123 MOD10 13 = 5 A 1-9 result means that the tested digits match the specified number of digits but fails the Modulus 10 algorithm. |