Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Wolfgang Riedmann" Newsgroups: comp.lang.clipper.visual-objects Subject: Re: IBAN calculation Date: Wed, 24 Jul 2013 18:33:00 +0200 Lines: 91 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: individual.net n6JPEp6mG6m7fPCEvrKKWQ6drUO67vGo0GV3M7UpQzSdQkMCY= Cancel-Lock: sha1:WXgohutZkt6F28k8gVFGNdp4nSI= User-Agent: XanaNews/1.18.1.6 Xref: csiph.com comp.lang.clipper.visual-objects:5578 Hi Martin, > Has anyone ever tried calculating IBAN's with VO 2.8 ? How to deal > with 24-digit long integers ? Does anyone know of a function that > might work ? Grateful for any hints ... look at this code: function IBANrechnen( cLand := "IT" as string, cCin as string, cAbi as string, cCab as string, cKonto as string ) as string pascal local cCheck as string local cIBAN as string if Empty( cCin ) cCin := CINRechnen( cAbi, cCab, cKonto ) endif cCheck := IBANCheck( cLand + "00" + cCin + PadL( cAbi, 5, "0" ) + PadL( cCab, 5, "0" ) + PadL( cKonto, 12, "0" ) ) cIBAN := cLand + cCheck + cCin + PadL( cAbi, 5, "0" ) + PadL( cCab, 5, "0" ) + PadL( cKonto, 12, "0" ) return cIBAN function IBANCheck( cIBAN as string ) as string pascal local cGru as string local cRest as string // local nI as dword // local nLen as dword local cReturn as string local nRest as dword local nWert as dword cGru := "" cRest := "" cIBAN := SubStr2( cIBAN, 5 ) + Left( cIBAN, 2 ) + "00" // Left( cIBAN, 4 ) _DebOut32( psz( "IBAN: " + cIBAN ) ) cIBAN := IBANNummer( cIBAN ) //_DebOut32( psz( "IBAN numerisch: " + cIBAN ) ) // Zahl ist zu lang für normale Berechnung cRest := cIBAN nWert := 0 while ! Empty( cRest ) nWert := nRest * 10 + Val( Left( cRest, 1 ) ) cRest := SubStr2( cRest, 2 ) nRest := nWert % 97 //_DebOut32( psz( "Wert: " + NTrim( nWert ) + " % 97 ergibt " + NTrim( nRest ) ) ) end cReturn := StrZero( 98 - nRest, 2 ) // geht nicht // nLen := SLen( cIBAN ) // for nI := 1 upto nLen step 8 // cGru := cRest + SubStr3( cIBAN, nI, 8 ) // cRest := NTrim( Integer( Val( cGru ) % 97 ) ) // next // cReturn := StrZero( ( 98 - Val( cRest ) ) % 97, 2 ) //_DebOut32( psz( "Prüfung: " + cReturn ) ) return cReturn function IBANNummer( cIBAN as string ) as string pascal local cTemp as string local cChar as string local nI as dword local nLen as dword cTemp := cIBAN cIBAN := "" nLen := SLen( cTemp ) for nI := 1 upto nLen cChar := SubStr( cTemp, nI, 1 ) if IsDigit( String2PSZ( cChar ) ) cIBAN := cIBAN + cChar else cIBAN := cIBAN + Str3( Asc( cChar ) - Asc( "A" ) + 10, 2, 0 ) endif next return cIBAN Wolfgang --