ABL Reference

Determines the remainder after division.

expression MODULO base |

expression

An integer expression. If the expression could result in a decimal value, then that value will be rounded before the MODULO operation occurs. This may or may not produce a result that is sensible for your business logic. For code readability, such an expression should be explicitly converted to an integer expression with attention to whether or not a rounded or truncated integer is correct for your application. See the INTEGER, ROUND, and TRUNCATE functions

base

A positive integer expression that is the modulo base. For example, angles measured in degrees use a base of 360 for modulo arithmetic. 372 MODULO 360 is 12.

This procedure determines the number of trucks required to ship a given quantity of material, and how much material is left over from a less than full truck load:

r-modulo.p

REPEAT: SET qty-avail AS INTEGER LABEL "Qty. Avail.". SET std-cap AS INTEGER LABEL "Std. Truck Capacity". DISPLAY TRUNCATE(qty-avail / std-cap,0) FORMAT ">,>>9" LABEL "# Full Loads" qty-avail MODULO std-cap LABEL "Qty. Left". END. |

The expression must be greater than 0 for MODULO to return a correct value.

© 2017 Progress Software Corporation and/or one of its subsidiaries or affiliates. All rights reserved.

Progress® OpenEdge® Release 11.7