IBM AS/400 Frozen Dessert Maker User Manual


 
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 worked
for that week and any bonus that employee may have received. The figure below
shows the format of a transaction record:
TRN_NUMBER
TRN_REC
1 6 10 16
TRN_HOURS TRN_BONUS
*.. 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 the TRANSACT
file) and the "rate" (from the EMPLOYEE file) and adding the "bonus" from the
TRANSACT file. If more than 40 hours were worked, the employee is paid for for
1.5 times 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 the separator.
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 specifications:
Chapter 1. Overview of the RPG IV Programming Language 7