MOD_OPERATOR
Back to current versionRestore this version

MOD - Modulus #

Returns the remainder resulting from dividing Operand 2 by Operand 3

Statement: Find the number of months that have passed since an employee’s last anniversary, and store the value into the Variable Months since Ann.

LineCMDOTOperand 1OPEROTOperand2OTOperand3If Goto Else GoTo
00010 LET V MONTHS TOTAL MBT DB EEM.HIRE_DATE $S PERIOD-END-DATE 00020
00020 LET V MONTHS SINCE ANN MOD V MONTHS TOTAL N 12 99999
99999 EXIT 99999

In the example above, the employee was hired Jan 1, 1998, and the pay period end date was June 1, 1999. The months between the two dates are divided by 12 months and the remaining months are returned.

June 1/99 – Jan1/98 = 18 18/12 = 1.5 12*0.5 = 6

The value that would be calculated in Months Since Ann would be 6.