Working with Polygons, especially irregular polygons, can be a real hassle. These procedures, part of the xRPG RNBMATH Service program, will help you work with polygons in RPG Programs. The approach is vaguely object oriented because the procedures retain information about the polygon data (until cleared).
A polygon is based on a collection of points with X and Y coordinates. Use the addPolygonPoint procedure to add a series of points. If your points are saved in a scale other than the actual scale, such as saved in pixels where 10 pixels = 1 foot, then you can set the scale to ".1" which will convert all calculations to the correct value. If your scale is accurate (i.e. 1=1) then you do not need to adjust the scale.
Once the points are created, you can calculate the number of points, the area, or the perimeter. Be aware that both the area and perimeter functions will clear the polygon points and the scale by default, so if you want to retain it you need to use the optional "savePoints" parameter.