Brilliant Christof Many thanks
-----Original Message----- From: ProfoxTech [mailto:profoxtech-boun...@leafe.com] On Behalf Of Wollenhaupt, Christof Sent: 16 April 2018 15:36 To: profoxt...@leafe.com Subject: Re: Modulo 97 of a very large number > > I need to calculate N % 97 aka Mod(N,97) for very large numbers > containing > 28 digits. Obviously VFP can't handle numbers that large but maybe > somebody can suggest some kind of piece-wise method that would enable > me to calculate what I need? > Sounds like an IBAN checksum calculation. Procedure IBAN (tcCountry, tcBBAN) Local lnChk, lcIBAN lnChk = 98 - This.CheckSum (m.tcCountry+"00"+m.tcBBAN) lcIBAN = m.tcCountry + Padl( Alltrim (Str(m.lnChk)), 2, "0") + m.tcBBAN Return m.lcIBAN Procedure Checksum (tcIBAN) Local lcBBAN, lcLK1, lcLK2, lcDigits lcBBAN = Substr (m.tcIBAN, 5, 18) lcLK1 = TRANSFORM (ASC (Left (m.tcIBAN,1))-55,"@L 99") lcLK2 = TRANSFORM (ASC (SUBSTR (m.tcIBAN,2,1))-55,"@L 99") lcDigits = m.lcBBAN + m.lcLK1 + m.lcLK2 + Substr(m.tcIBAN,3,2) Local lnMod, lnPos, lnDigit lnMod = 0 For lnPos = 1 to Len(m.lcDigits) lnDigit = Val (Substr (m.lcDigits, m.lnPos, 1)) lnMod = ((m.lnMod * 10) + m.lnDigit) % 97 EndFor Return m.lnMod If you by chance need to generate German SEPA XML files, we have a VFP solution for that. It should be adoptable for other countries with minor changes. -- Christof -- foxpert GmbHUlzburger Straße 352 22846 Norderstedt Tel. Zentrale: (040) 605 3373-70 Fax: (040) 605 3373-75 http://www.foxpert.com <http://www.foxpert.com> Registergericht: Amtsgericht Kiel, HRB 19260 KI Sitz der Gesellschaft: Norderstedt Geschäftsführer: Christof Wollenhaupt --- StripMime Report -- processed MIME parts --- multipart/alternative text/plain (text body -- kept) text/html --- _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cal4qjhgtgiwq3wc0o38fqhbk1kcrzjpnfrzr9i7+fbkzep8...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious. Report [OT] Abuse: http://leafe.com/reportAbuse/cal4qjhgtgiwq3wc0o38fqhbk1kcrzjpnfrzr9i7+fbkzep8...@mail.gmail.com _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/by2pr0201mb179780f0bb8dee274c9d35a6a1...@by2pr0201mb1797.namprd02.prod.outlook.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.