But it seems you're trying to calculate the "IBAN" - International Bank Account Number. You may look at my solution for this, to be found in the German Xbase Forum:
Yes, you are right... I need to calculate IBAN check number...
I look at this forum, but ... "ich nix verstehen" german language.... do you have on this on some other place?
FUNCTION CalcIban(cCiBlz,cCiKonto,cCiIban,cCiLaenderCode)
with at least two parameters, the account number and the old numeric bank id ("Bankleitzahl" in germany). If done so, the country code defaults to "DE" (you may change this in line 3 of the function), if you want to submit a country code, fill the 3rd parameter with Space(22) or an existing IBAN to validate. The function shows how to fragment the large number and calculate the number stepwise. The function "NurZiffern" extracts all the digits from a string ("JustDigits").
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
You may take a look at the string padding. Account numbers are filled with trailing zeros in this version - but leading zeros may be correct (change PadR() to PadL()).
Best regards,
Tom
"Did I offend you?"
"No."
"Okay, give me a second chance."
You can use the TORCH browser to translate any website from most popular language to another. Worked very well. Because of this unique capability it is my default internet browser.
//
// cNumber = "22152829123456987654322612"
//
// Check if cNumber with Mod 10,97 (ISO/IEC 7064:2003) model
//
For ni := 1 To Len(cNumber)
nValue := Asc(cNumber[ni])-48
nRet := ((nRet * 10 ) + nValue) % 97
Next ni
//
// The checksum is part of the calculation (last 2 digits)
// Calculate last 2 digits that result in Mod 97 = 1
//
nRet := nRet * 100
nRet := nRet % 97
nRet := 97 - nRet + 1