IBAN - International Bank Account Number - SWIFT

IBAN - International Bank Account Number - SWIFT

Postby Otto » Mon Jan 28, 2013 6:49 am

Hier ein Link, wie man IBAN - International Bank Account Number - SWIFT berechnet.
mfg
Otto

http://www.xbaseforum.de/viewtopic.php?f=6&t=6863
User avatar
Otto
 
Posts: 3280
Joined: Fri Oct 07, 2005 7:07 pm

Re: IBAN - International Bank Account Number - SWIFT

Postby StefanHaupt » Mon Jan 28, 2013 7:53 am

und eine Function, die IBAN zu überprüfen

Code: Select all  Expand view
FUNCTION CheckIBAN (cIBAN)
  LOCAL cCountryID := SubStr (cIBAN,1,2)
  LOCAL cCheck := SubStr (cIban,5,Len(cIban)) +;
                  SubStr (CreateCountryID (cCountryID),1,4)+;
                  Substr (cIBAN,3,2)
  LOCAL nCheck, nID

  nID := ( _CalcModulo (cCheck))
  nCheck := Int (nId % 97)
//? cCheck, nID, nCheck
RETURN (nCheck == 1)

//-------------------------------------------------------------//
STATIC FUNCTION CreateCountryID (cCountry)

  LOCAL cLatin := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  LOCAL nID  := At (Substr(cCountry,1,1),cLatin)+9
  LOCAL nID2 := At (Substr(cCountry,2,1),cLatin)+9
RETURN (Str (nID,2,0)+Str(nID2,2,0)+"00")

//---------------------------------------------------------------------//
STATIC FUNCTION _CalcModulo (cControlNr)

  LOCAL nMod //:= Int (Val (cControlNr)) % 97
  LOCAL nNr, cNr //:= 98 - nMod, nVal :=  Val (cControlNr)
  LOCAL cMod := "", i, cID

  FOR i := 1 TO Len (cControlNr) STEP 8
    cNr := cMod+Substr (cControlNr,i,8)
    nNr := Val (cNr) % 97
    cMod := Str (nNr, Lennum (nNr),0)
  NEXT
  nMod := Int (Val (cMod))

RETURN (nMod)

 
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to All products support

Who is online

Users browsing this forum: No registered users and 1 guest