We have been using this Mod10 code for years. Note - CLEN = LEN(CARD.NUM)
0076 **
0077 **
0078 **
0079 ALGO.CHECK: ** card number algorithm check
0080 CSTR = ; PTR = 0
0081 FOR I = CLEN TO 1 STEP -1
0082 PTR = PTR + 1
0083
SUBROUTINE CC.VALID(CCN,OK,CTYPE)
*
OK=0 ; WGT=2 ; SUM=0 ; CCLEN=LEN(CCN)
DIGIT=0 ; CTYPE=
CHK.DIGIT=CCN[CCLEN,1] ; MDIGIT=0
FOR X = CCLEN - 1 TO 1 STEP -1
CC.D=CCN[X,1]
IF NOT(NUM(CC.D)) THEN CC.D=-9
DIGIT=WGT * CC.D
SUM=SUM +
Today's your lucky day. I have the LUHN check (and much more) written
in Javascript and posted on the web @
http://www.precisonline.com/ccvalidate.html. Should be no big deal to
translate to U2.
-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com
---
u2-users mailing list
Baker,
This is pretty old code and it was taken out of production last January,
However, it was working at the point we stopped using it. Sorry,
there's not much documentation, but I seem to recall that it used the
MOD10 method.
Give it a try and see what happens.
Mick
Mick Gahan
Director,
Barker,
I haven't needed to know this for the last several years, so I had
to look it up. This looks right, but you should double check it:
http://www.epanorama.net/documents/smartcard/magcard.html
- Chuck LRC Barouch
Baker Hughes wrote:
Say, has anyone written some code to
Did this a long 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
Thanks James. This is a project I'm embroiled in, too. Your code worked
right out of the box.
Karl
quote who=James F Thompson
SUBROUTINE CC.VALID(CCN,OK,CTYPE)
*
OK=0 ; WGT=2 ; SUM=0 ; CCLEN=LEN(CCN)
DIGIT=0 ; CTYPE=
CHK.DIGIT=CCN[CCLEN,1] ; MDIGIT=0
FOR X =
Thanks to each of you for the good postings. You've got me going now. I
may miss their target date of yesterday but Tuesday is looking pretty
good. Now, if anyone has an algorithm to speed up the QA dept things
will shake out rather nicely. We'll be using something which follows
very closely on