|
Crap! That's what I thought. :( -Bob -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barr, Regan Sent: Wednesday, February 25, 2004 9:26 AM To: RPG400-L Subject: RE: Modulus 10 formula (REPOST) Bob, I'm just finishing up a credit card project, and I found that there seem to be as many versions of the Mod10 as there are merchants/card issuers. I was working primarily with validating merchant numbers. One bank used only the last 6 digits of the number, beginning with the left and working to the right. Another used the entire number, but if the first 3 digits fell within a certain range, you changed the first digit of the number to 0, then worked your Mod10 from right to left. There was no way I could use the canned IBM Mod10 function for display files. I had to write my own Mod10 validation routine for every issuing bank. I'm not sure this answers whether there are 2 "official" versions, but I found that to be irrelevant, since no one used it without significant modifications. I guess everyone knows how to break Mod 10 these days, so banks are getting creative in how they apply it. Regan L. Barr Cintas - Corp. Systems Accounting & Finance Systems Analyst ------------------------------ date: Wed, 25 Feb 2004 08:43:10 -0600 from: "Bob Cozzi" <cozzi@xxxxxxxxx> subject: RE: Modulus 10 formula (REPOST) 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 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.