IBM AS/400 Frozen Dessert Maker User Manual


 
Example of an ILE RPG Program
P CalcPay B
D CalcPay PI 8P 2
D Rate 5P 2 VALUE
D Hours 10U 0 VALUE
D Bonus 5P 2 VALUE
D Overtime S 5P 2 INZ(0)
* Determine any overtime hours to be paid.
C IF Hours > 40
C EVAL Overtime = (Hours - 40) * Rate * 1.5
C EVAL Hours = 40
C ENDIF
* Calculate the total pay and return it to the caller
C RETURN Rate * Hours + Bonus + Overtime
P CalcPay E
The Entire Source Program
The following figure combines all the specifications used in this program. This is
what you should enter into the source file for this program.
*------------------------------------------------------------------------*
* DESCRIPTION: This program creates a printed output of employee's pay *
* for the week. *
*------------------------------------------------------------------------*
H DATEDIT(*DMY/)
*------------------------------------------------------------------------*
* File Definitions *
*------------------------------------------------------------------------*
FTRANSACT IP E K DISK
FEMPLOYEE IF E K DISK
FQSYSPRT O F 80 PRINTER
*------------------------------------------------------------------------*
* Variable Declarations *
*------------------------------------------------------------------------*
D Pay S 8P 2
Figure 4 (Part 1 of 3). A Sample Payroll Calculation Program
10 ILE RPG for AS/400 Programmer's Guide