----- Original Message ----- From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Monday, March 31, 2008 3:16 PM
Subject: Re: Classic Traps -- I need your input!

Quarter = %div(Month : 3.01) + 1;

The compiler won't like that one. Make it normal division q=(m/3.01)
+1 and it works. I don't like this because it's obscure.
I agree - too obscure. Never realized you can only use integers in %div - thanks.


Quarter %dim(Month + 2 : 3);

I don't like that one either. It makes it harder to deal with
financial quarters.
At least in my actual code I typed this one correctly. %dim never had a chance :)


For me I wouldn't do this calculation in direct code. I'd write a
generic procedure:
getQuarterOfYear( date [, fiscalPeriodStart] )
True. I left the formula in the C spec for this one because we do not really do much by quarter anyhow, and we use a straight calendar. This one program is the only one I have seen here with any mention of quarters at all. And even then it is largely ignored.

I am still amused how much time has gone into fixing something that was not broken to begin with. At least the episode was educational.


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.