Informix MOD operator
Posted in 1991
Path: emory!samsung!uunet!infonode!ingr!nijmeg!clercqm From: clercqm@nijmeg.ingr.com (Marien de Clercq) Newsgroups: comp.databases Keywords: Modulus, informix Message-ID: <1991Aug29.124418.7361@nijmeg.ingr.com> Date: 29 Aug 91 12:44:18 GMT Organization: Intergraph Nijmegen In Informix-4GL I use the MOD operator quite a lot to do different kind of things, but lately I got stuck when I needed it to check Belgian bankaccounts. They had to be checked in the following way: The last two figures (of 12) of the account have to be equal to the modulus 97 of the first 10 figures: bankaccount[11,12] = bankaccount[1,10] mod 97 So I tried to use the MOD operator, but that didn't work on accounts bigger than 2147483647 (the maximum number to be stored in an integer, as you will have noticed). I made the following function as a work-around to get the modulus 97 out of a (big) number: FUNCTION mod97(number) DEFINE number DECIMAL(16,0), quot INTEGER LET quot = number / 97 RETURN (number - (quot * 97)) END FUNCTION This works allright, but what I'd like to know: - is this problem solved in version 4.0 ? (We still use 2.10.03) - is there a better solution to this problem ? Much obliged for any reaction, -- Marien de Clercq Intergraph European Manufacturing bv. ______ Nijmegen - The Netherlands /| /| / / / | / | / / E-mail: (...!uunet!ingr!)nijmeg!m_clercq / |/ | / / clercqm@nijmeg.ingr.com / | ___/ / Phone : +31.80.525725 / | / / / Fax : +31.80.558420 / | /__/ \\______