IBM AS/400 Example of an ILE RPG Program, Output Specifications, Name, Rate, Ours, Trnnumber

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 32
Image 32

Example of an ILE RPG Program

¹The TRANSACT file is defined as the Input Primary file. The ILE RPG

cycle controls the reading of records from this file.

¹The EMPLOYEE file is defined as the Input Full-Procedure file. The re

records from this file is controlled by operations in the calculatio

¹The QSYSPRT file is defined as the Output Printer file.

Definition

Specifications

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*..

1

...+...

2 ...

+...

3 ...

+

... 4

...

+...

5

...+...

6 ...

+...

7 ...

+...

D+Name++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++

D Pay

 

 

S

 

 

8P

2

 

 

 

 

 

 

 

D Heading1

 

C

 

 

 

 

'NUMBER

NAME

 

 

RATE

H-

D

 

 

 

 

 

 

 

 

OURS

BONUS

PAY

'

 

 

D Heading2

 

C

 

 

 

 

'______ ________________ ______ _-

D

 

 

 

 

 

 

 

 

____

_______

__________'

 

 

D CalcPay

 

PR

 

 

8P

2

 

 

 

 

 

 

 

D

Rate

 

 

 

 

5P

2

VALUE

 

 

 

 

 

 

D

Hours

 

 

 

 

10U

0

VALUE

 

 

 

 

 

 

D

Bonus

 

 

 

 

5P

2

VALUE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Using the definition specifications, declare a variable called "Pay" t employees' weekly pay and two constants "Heading1" and "Heading2" to ai printing of the report headings.

Calculation

Specifications

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*..

1

...+...

2 ...

+

... 3 ...

+

... 4 ...

+...

5 ...

+...

6 ...

+...

7 ...

+...

CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq.￿.

C

 

TRN_NUMBER

 

CHAIN

 

EMP_REC

 

 

 

 

 

99

 

C

 

 

 

 

IF

 

NOT *IN99

 

 

 

 

 

 

 

C

 

 

 

 

EVAL

 

PAY = CalcPay(EMP_RATE : TRN_HOURS :

 

C

 

 

 

 

 

 

 

 

TRN_BONUS)

 

 

 

 

C

 

 

 

 

ENDIF

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The coding entries on the calculation specifications include:

¹ Using

the CHAIN

operation code, the field

TRN_NUMBER from the transa

file

is used to

find the record with the

same employee number in

file.

 

 

 

¹If the CHAIN operation is successful (that is, indicator 99 is off employee is evaluated. The result is "rounded" and stored in the v Pay.

Output Specifications

8 ILE RPG for AS/400 Programmer's Guide

Page 32
Image 32
IBM AS/400 manual Example of an ILE RPG Program, Output Specifications, Name, Rate, Ours, Trnnumber, Emprec