Number rounding
If you intend to execute your rules using generated COBOL code, the method Util.Rounded supports the COBOL ROUNDED clause for rule authoring.
The method Util.Rounded supports the COBOL ROUNDED clause for rule authoring. It is defined in the cobol_extension BOM.
In COBOL, when a calculation results in a number that exceeds the number of places provided for its storage, truncation occurs unless you use the ROUNDED clause. When you specify ROUNDED, the least significant digit of the excess is rounded up to the next whole number if the digit is greater than or equal to 5.
For example, if in COBOL you have a COBOL item definition Item, defined as:
01 Item PIC 9V9.
You then write the following rule:
set the value of item to rounded (2.39 + 2.1) ;
In this example the generated COBOL code is: COMPUTE Item ROUNDED = 4.49, and the value assigned to Item is 4.5.
To use number rounding, you must first import the cobol_extension BOM into your rule project:
In your rule project, right-click the bom folder.
Click
.
The cobol_extension BOM is added to the bom folder in the Rule Explorer.