There are a number of different Mod10 algorithms, I don't think they were
intended to be the same, people just aren't creative enough to come up
with new names :)

For example, the Mod10 used in calculating the check digit on a UPC/EAN
code is different from that used on a credit card...

You simply have to use the correct the algorithm for what you're doing...

On Wed, 25 Feb 2004, Bob Cozzi wrote:

> Gosh, is it too early for me to type or what??? :)
> -Bob
>
> I've been going back and forth on a Modulus10 routine because, as it turns
> out there seems to be two different formulas: IBM and LUHN.
> The biggest issue is a subtle one which follows.
> With IBM, you always start with the left most digit (highest order digit)
> and select the even position digits by moving to the right and multiplying
> hem by two.
> This seems to be done regardless of the length of the original number;
> therefore,  34567 would use 3, 5 and 7, and 4567 would use 4 and 6.
> But the LUHN Modulus 10 formula begins with the rightmost digit (lowest
> order digit) and selects every other digit moving to the left, and multiples
> them by two.
>
> So with IBM we would get this (starting on the left):
>
> Start with:  3456
> Step 1:  Multiple 3 and 5 by 2 =  6 10
> Step 2: Add them:  6 + 4 + 1 + 0 + 6  = 17
> Step 3:  20 - 17 = 3
> Check Digit = 3
> Result:   3456-3
>
> But with the LUHN formula we would get this:
>
> Start with 3456
> Step 1: Multiple 4 and 6 by 2 = 12 and 8
> Step 2: Add them:  3 + 8 + 5 + 1 + 2 = 19
> Step 3:  20 - 19 = 1
> Check Digit = 1
> Result:  3456-1
>
>
> So is the IBM one screwy or are there two of them?
>
> -Bob Cozzi
>
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.