Page 1 of 1

Mod 10 Check Routine

Posted: Tue Aug 28, 2007 12:19 pm
by kool_cons
Does any one has mod 10 check routine to validate any number?

Re: Mod 10 Check Routine

Posted: Tue Aug 28, 2007 12:39 pm
by gateleys
kool_cons wrote:Does any one has mod 10 check routine to validate any number?
What is the problem that you are facing?
What is your input?
What output do you expect?

Posted: Tue Aug 28, 2007 12:47 pm
by kool_cons
I have to validate credit card number whether it is mod 10 or not. Example: 123466(input)
2*1+2+2*3+4+2*6+6
2+2+6+4+12+6
2+2+6+4+(1+2)+6=23/10..is not a valid mod 10 check. i should throw an error.

Posted: Tue Aug 28, 2007 12:52 pm
by gateleys
kool_cons wrote:I have to validate credit card number whether it is mod 10 or not. Example: 123466(input)
2*1+2+2*3+4+2*6+6
2+2+6+4+12+6
2+2+6+4+(1+2)+6=23/10..is not a valid mod 10 check. i should throw an error.
Try the logic-

Code: Select all

If MOD(InputSum, 10) = 0 Then 'OK' Else 'Error'

Posted: Tue Aug 28, 2007 1:57 pm
by satya99
1. First check for the credit card number(CC_NO)

sv1 If LEN(Trim(CC_NO,' ','A')) = 16 Then @True Else @False

2. Then check for mod 10.

sv2 If Mod(Trim(CC_NO,' ','A'),10) = 0 Then @True Else @False

3. Constraints sv1 and sv2

Good Luck

Posted: Tue Aug 28, 2007 2:43 pm
by throbinson
Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.

Posted: Tue Aug 28, 2007 4:45 pm
by ray.wurlod
:!:
Beware that some credit cards (e.g. Diners Club) are 14 digits.

Posted: Tue Aug 28, 2007 6:56 pm
by chulett
throbinson wrote:Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.
:wink:

Guys - be aware that a check digit verification is much more than a simple 'mod 10' on the base number. For example:

http://www.beachnet.com/~hstiles/cardtype.html

After applying the LUHN formula to the number, the answer must be a multiple of 10, that is a 'mod 10' of the result must be zero - not of the credit card number.

Posted: Tue Aug 28, 2007 9:59 pm
by kcbland
throbinson wrote:Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.
:lol:
:lol:
:lol:

Fell off the chair on this one

Posted: Tue Aug 28, 2007 11:01 pm
by ArndW
Well, since you are a charter member, here are my numbers: