}P
Figure 1 - Free-format RPG code
.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+++++++++
/Free
Dou %EOF(TimeRecord); //
Process all time records
Read(e) TimeRecord; //
Get next time record
Select;
When %EOF(TimeRecord);
Leave;
When %ERROR;
Dsply 'Error reading time records.';
Leave;
Other;
Chain(ne) EmployeeID Employees;
Select;
When %ERROR;
Dsply
'Error reading employees.';
Leave;
When not %FOUND;
Dsply
'Employee not found.';
Iter;
Endsl;
TotalPay = (RegHours
* Rate)
+
(OvtHours * Rate * 1.5)
+
(DblHours * Rate * 2);
FedTax = CalcTaxes(FED:EmployeeID:TotalPay);
FICATax = CalcTaxes(FICA:EmployeeID:TotalPay);
StateTax = CalcTaxes(EmpState:EmployeeID:TotalPay);
A
UpdateTimeRecord();
B
Endsl;
Enddo;
*INLR = *ON;
Return;
/End-Free