Re: HELP How to get a remainder in 4GL
Posted in 1996
sandys@easter.euro.csg.mot.com ("Sandy Spiers") wrote: >On May 21, 3:17pm, Bob Payne wrote: >> How do you get a remainder (aka modulus) in INFORMIX-4GL? >Hey bob, >you were close its actually the 'MOD' command you're looking for and you're >right its not in the 4.0 manuals. I think its released "officially" with the >6.0 but heres an example anyway.. > IF this_number MOD that_number = 0 THEN > ... blah ... blah ... blah > END IF >Hope it helps >sandys :) And here's a recent post using mod to find the number of days for a certain month. function fn_leap(fndate) define fndate date, j, k smallint let j = month(fndate) if j = 4 or j = 6 or j = 9 or j = 11 then return 30 end if if j <> 2 then return 31 end if let k = year(fndate) if k mod 100 = 0 then if k mod 400 = 0 then return 29 else return 28 end if else if k mod 4 = 0 then return 29 end if end if return 28 end function Louis DeLongchamp loudelon@vianet.on.ca