How to: |

Available Languages: reporting, Maintain

The MOD functions calculate the remainder from a division. Each function returns the remainder in a different format.

The functions use the following formula.

remainder=dividend- INT(dividend/divisor) *divisor

*DMOD*returns the remainder as a decimal number.*FMOD*returns the remainder as a floating-point number.*IMOD*returns the remainder as an integer.

function(dividend,divisor,output)

where:

`function`-
Is one of the following:

`DMOD`returns the remainder as a decimal number.`FMOD`returns the remainder as a floating-point number.`IMOD`returns the remainder as an integer. `dividend`-
Numeric

Is the number being divided.

`divisor`-
Numeric

Is the number dividing the dividend.

`output`-
Numeric

Is the result whose format is determined by the function used. Can be the name of the field that contains the result, or the format of the output value enclosed in single quotation marks.

If the divisor is zero (0), the dividend is returned.

IMOD divides ACCTNUMBER by 1000 and returns the remainder to LAST3_ACCT:

```
TABLE FILE EMPLOYEE
PRINT ACCTNUMBER AND COMPUTE
LAST3_ACCT/I3L = IMOD(ACCTNUMBER, 1000, LAST3_ACCT);
BY LAST_NAME BY FIRST_NAME
WHERE (ACCTNUMBER NE 000000000) AND (DEPARTMENT EQ 'MIS');
END
```

The output is:

LAST_NAME FIRST_NAME ACCTNUMBER LAST3_ACCT --------- ---------- ---------- ---------- BLACKWOOD ROSEMARIE 122850108 108 CROSS BARBARA 163800144 144 GREENSPAN MARY 150150302 302 JONES DIANE 040950036 036 MCCOY JOHN 109200096 096 SMITH MARY 027300024 024

WebFOCUS | |

Feedback |