IBM AS/400 manual Program, Control Specifications, File Description Specifications

Models: AS/400

1 489
Download 489 pages 47.95 Kb
Page 31
Image 31
Program

 

 

 

 

 

 

 

 

 

 

Example

of an

ILE

RPG

Program

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

*..

1

...+...

2 ...

+...

3

...+

...

4 ...

+...

5 ...

+

... 6 ...

+...

7 ..

*

 

A

 

T.Name++++++RLen++TDpB

Functions++++++++++++++++++++*

 

A

 

 

R EMP_REC

 

 

 

 

 

 

 

 

 

 

 

 

A

 

 

EMP_NUMBER

 

5

 

 

TEXT('EMPLOYEE NUMBER')

 

 

 

A

 

 

EMP_NAME

 

16

 

 

TEXT('EXPLOYEE NAME')

 

 

 

A

 

 

EMP_RATE

 

5

2

 

TEXT('EXPLOYEE RATE')

 

 

 

A

 

 

K EMP_NUMBER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure

2.

DDS for Employee physical file

 

 

 

 

 

 

The

second file,

TRANSACT,

tracks

the

number

of

hours each employee wo

for

that

week

and

any

 

bonus that employee may have received. The

shows

the

format

of

a

 

transaction

record:

 

 

 

 

TRN_REC

TRN_NUMBER

TRN_HOURS TRN_BONUS

161016

*.. 1

...+...

...2

+...

3

...+

...... 4

+...

...5

+...

6 ...

+...

7 ..*

A

T.Name++++++RLen++TDpB

Functions++++++++++++++++++++*

A

 

R TRN_REC

 

 

 

 

 

 

 

 

 

A

 

TRN_NUMBER

 

5

 

TEXT('EMPLOYEE NUMBER')

 

A

 

TRN_HOURS

 

4

1

TEXT('HOURS WORKED')

 

 

A

 

TRN_BONUS

 

6

2

TEXT('BONUS')

 

 

 

 

 

 

 

 

 

 

 

Figure

3.

DDS for TRANSACT physical file

 

 

 

 

 

Each employee's pay is calculated by multiplying the "hours" (from th file) and the "rate" (from the EMPLOYEE file) and adding the "bonus" TRANSACT file. If more than 40 hours were worked, the employee is pa

1.5times the normal rate.

Control Specifications

*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8 HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

H DATEDIT(*DMY/)

Today's date will be printed in day, month, year format with "/" as

File Description Specifications

..*

1 ...

+...

2 ...

+...

3

...

+

... 4 ...

...+

...5

...+

...6

...+

...7

+...

FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++

FTRANSACT

IP

E

 

 

K

 

DISK

 

 

 

 

 

 

 

FEMPLOYEE

IF

E

 

 

K

 

DISK

 

 

 

 

 

 

 

FQSYSPRT

O

F

80

 

 

 

PRINTER

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

There are three files defined on the file description specificatio

Chapter 1. Overview of the RPG IV Programming7 Language

Page 31
Image 31
IBM AS/400 manual Program, Control Specifications, File Description Specifications