Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Calculating Remainder

Former Member
0 Likes
476

Hi All,

I have a program that automatically creates background jobs for payroll using RPCALCQ0. I have made a few modications so that the user now has the option of selecting the number of jobs to be ran and can enter the number of employees to be ran manually on the selection screen (or via a .csv file)

A working example is: if i have 10 employees and want 5 jobs, the program will create 5 jobs with 2 employees for each job.

An small example of my issue is:

If i have 5 employees but want to run 4 jobs.

The program currently will create 5 jobs as it doesnt take into account the remainder.

I was wondering if anyone knows how to solve this issue (is there a function module i can use), or just a way of checking for a remainder.

Thank you,

Daniel

Hi All,

I have a program that automatically creates background jobs for payroll using RPCALCQ0. I have made a few modications so that the user now has the option of selecting the number of jobs to be ran and can enter the number of employees to be ran manually on the selection screen (or via a .csv file)

A working example is: if i have 10 employees and want 5 jobs, the program will create 5 jobs with 2 employees for each job.

An small example of my issue is:

If i have 5 employees but want to run 4 jobs.

The program currently will create 5 jobs as it doesnt take into account the remainder.

I was wondering if anyone knows how to solve this issue (is there a function module i can use), or just a way of checking for a remainder.

Thank you,

Daniel

1 REPLY 1
Read only

Former Member
0 Likes
443

Hi,

Let the number of Jobs be X and the Number of employees be Y, So

remainder = Y MOD X

If the remainder is not 0, then you have to add Last reaminder number of employees to the last Job.

As per your example

Remainder = 1( 5 mod 4 )

So the 4th Job will have 5/4 + 1 employee ie 1+ 1 = 2 employees job.

Hope this helps