Mod 10 Check Routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kool_cons
Participant
Posts: 68
Joined: Thu Jul 07, 2005 3:41 pm

Mod 10 Check Routine

Post by kool_cons »

Does any one has mod 10 check routine to validate any number?
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Mod 10 Check Routine

Post by gateleys »

kool_cons wrote:Does any one has mod 10 check routine to validate any number?
What is the problem that you are facing?
What is your input?
What output do you expect?
gateleys
kool_cons
Participant
Posts: 68
Joined: Thu Jul 07, 2005 3:41 pm

Post by kool_cons »

I have to validate credit card number whether it is mod 10 or not. Example: 123466(input)
2*1+2+2*3+4+2*6+6
2+2+6+4+12+6
2+2+6+4+(1+2)+6=23/10..is not a valid mod 10 check. i should throw an error.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Post by gateleys »

kool_cons wrote:I have to validate credit card number whether it is mod 10 or not. Example: 123466(input)
2*1+2+2*3+4+2*6+6
2+2+6+4+12+6
2+2+6+4+(1+2)+6=23/10..is not a valid mod 10 check. i should throw an error.
Try the logic-

Code: Select all

If MOD(InputSum, 10) = 0 Then 'OK' Else 'Error'
gateleys
satya99
Participant
Posts: 104
Joined: Thu Nov 30, 2006 1:22 pm

Post by satya99 »

1. First check for the credit card number(CC_NO)

sv1 If LEN(Trim(CC_NO,' ','A')) = 16 Then @True Else @False

2. Then check for mod 10.

sv2 If Mod(Trim(CC_NO,' ','A'),10) = 0 Then @True Else @False

3. Constraints sv1 and sv2

Good Luck
satya
throbinson
Charter Member
Charter Member
Posts: 299
Joined: Wed Nov 13, 2002 5:38 pm
Location: USA

Post by throbinson »

Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

:!:
Beware that some credit cards (e.g. Diners Club) are 14 digits.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

throbinson wrote:Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.
:wink:

Guys - be aware that a check digit verification is much more than a simple 'mod 10' on the base number. For example:

http://www.beachnet.com/~hstiles/cardtype.html

After applying the LUHN formula to the number, the answer must be a multiple of 10, that is a 'mod 10' of the result must be zero - not of the credit card number.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

throbinson wrote:Please post a few of your Credit Card numbers from production with the Expiration dates and 4 digit verification codes from the back and I'll try them out. I'll have an answer for you in a couple of weeks. Ones with large limits would be prefereable for true stress testing.
:lol:
:lol:
:lol:

Fell off the chair on this one
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Well, since you are a charter member, here are my numbers:
Post Reply