You are here: Function Reference > Alphabetical Listing > M > MOD

MOD

Use this function to return the remainder from modular arithmetic.

Syntax

MOD (Numerator, Denominator)

Parameter

Description

Numerator

Enter the value you want used as the numerator.

Denominator

Enter the value you want used as the denominator.

The system returns the integer remainder from an integer division.

Note If you enter zero (0) as either the numerator or denominator, the system returns zero. Decimal or string input parameters are converted to integer values prior to the calculation.

Example

Assume you have the following entry in the SETRCPTBL.DAT file for the form trigger being processed. Also assume there are 30 records in the extract file that match the search mask. Here is an example:

BeginSub F1550
#rec = CountRec("1,F1550,31,Data")
#remaining = MOD(#rec, TriggerRecsPerOvFlw( ))
While(#remaining > 0)
*    write additional records
 Write_fm( )
 #mod -= 1
Wend
Return(#rec)
EndSub

In this example, the MOD function returns the integer remainder of 5. If no extract records matched the search mask, the system would have returned zero (0).

See also