Did this a lonnnnnggggg time ago.  It wont cost much to see if it works.
j
**      SUBROUTINE MOD10CD(NUM1, CDNUM)
M2STR= ""
SUM.STRING=""
SUM.OPERANDS=""
NEXT.HIGH.10=0
INPUT NUM1
LNUM1=LEN(NUM1)
FOR I = LNUM1 TO 1 STEP -2
IF MOD(I,2) = 0 THEN
SUM.STRING<-1>=NUM1[I,1]
END ELSE
M2STR:=NUM1[I,1]
END
NEXT I
M2STRM=M2STR*2
SUM.OTHER = SUM(SUM.STRING)
NUM.MULT.DIGITS=LEN(M2STRM)
FOR I = 1 TO NUM.MULT.DIGITS
OPERAND=M2STRM[I,1]
SUM.OPERANDS+=OPERAND
NEXT I
FINAL.SUM=SUM.OPERANDS + SUM.OTHER
FINAL.SUM=SUM.OPERANDS + SUM.OTHER
LOOP
UNTIL NEXT.HIGH.10 >= FINAL.SUM
NEXT.HIGH.10 += 10
REPEAT
CDNUM = NEXT.HIGH.10 - FINAL.SUM
CRT CDNUM
RETURN


On 12/2/05, Baker Hughes <[EMAIL PROTECTED]> wrote:
> 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/
>


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

Reply via email to