RPG is a fantastic language for business calculations, but sometimes it needs a little help with the more esoteric computations, and that's where APIs come in.
Written by Joe Pluta
I recently had an opportunity to program some electrical formulas (or do you say formulae?). This took me out of my normal comfort zone of traditional business mathematics and made me hearken back to my days of algebra and trigonometry. While I couldn't have done this in RPG III, it is possible in RPG IV—even using the traditional fixed-format technique. And if you're willing to stretch a bit and use ILE concepts, it's actually quite easy to do arbitrarily complex mathematical calculations in RPG IV and especially in free-format RPG. All you need is a good set of mathematical APIs, and as it turns out, the IBM i provides you with not one, but two distinct sets of APIs that can be used for the purpose: the CEE APIs and the C Runtime APIs. This article will cover the CEE APIs, and I'll follow up with the C Runtime APIs in a second article.
As you probably know, Simon Coulter, a knowledgeable and versatile IBM i expert, passed away in October 2010. Simon was loved by many IBM i developers because he was one of the giants in the industry, on whose shoulders others could stand and reach for new heights.
Among all his posts in the news lists at midrange.com, there was one in which Simon introduced a technique that is critical to analyzing MI instruction streams of OPM programs: Re: QPROCT and QPRODT.