Sample Request:  Rounding Numbers

The sample report below is an example of using defines to round gross pay amounts.  The first define ROUNDED, rounds the gross pay by changing PH:GROSSPAY from a P12.2M format to a P12 format.  Amounts with cents greater than or equal to .50 will round up to the next dollar.  The second define GROSSPAY, displays the amount with two decimal places and a dollar sign.

 

Report Request:

 

EX PH
DEFINE FILE PH ADD
ROUNDED/P12 = PH:GROSSPAY;
GROSSPAY/P12.2M = (ROUNDED*1.00);
END
TABLE FILE PH
PRINT PH:GROSSPAY ROUNDED GROSSPAY
END

 

 

Report Generated:

 

PH:GROSSPAY   ROUNDED    GROSSPAY
-----------   -------    --------
$1336.86         1337    $1337.00
$2200.12         2200    $2200.00
$3288.50         3289    $3289.00
$1253.00         1253    $1253.00