IBM AS/400 manual Example of an ILE RPG Program, The Entire Source Program, for the week

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 34
Image 34
The Entire Source Program

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 progra 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

Page 34
Image 34
IBM AS/400 Example of an ILE RPG Program, The Entire Source Program, for the week, File Definitions, Variable Declarations