CARD = OCONV(CARD,'MCN')
 TOTAL = 0
 MULT = 2
 FOR X = LEN(CARD)-1 TO 1 STEP -1
   DIGIT = CARD[X,1] * MULT
   IF DIGIT GT 9 THEN DIGIT = DIGIT[1,1] + DIGIT[2,1]
   TOTAL += DIGIT
   MULT = 3 - MULT
 NEXT X

 CHECK = MOD(10-MOD(TOTAL,10),10) 
 IF CHECK NE CARD[1] THEN
   ! No match
 END


Larry Hiscock
Western Computer Services


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Baker Hughes
Sent: Friday, December 02, 2005 8:11 AM
To: [email protected]
Subject: [U2] Mod10 Credit Card Checksum

Say, has anyone written some code to validate a Credit Card number, using
the Mod10 (nicknamed) or ANSI X4.13 (realname) LUHN formula?  I was just
told today get this installed yesterday, so I'm naturally looking to see if
some kind-hearted fellow MV'ver has something already written (it is the
season for giving ;-) ).

I searched ansi.org and only got hits on meeting agendas - [in session
4.13 discuss blah blah]
I found the previous u2ug posting that used Mod10 to validate a UPC, but it
looks a bit different from algorithm described elsewhere to validate
CCnumbers, and doesn't look agreeable to variable lengths (different you
know based on each card type).

I'm really thankful for U2UG, and glean much from the postings.  I'd
contribute more answers but I've only been at this 14 years and someone more
seasoned invariably gives a thoroughly enlightening response.

TIA.

-Baker
bakerdothughes
atmouser
dotcom
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[email protected]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to