Methods for Processing Disk Files
A*****************************************************************
A* DESCRIPTION: This is the DDS for the physical file EMPMST. *
A* It contains one record format called EMPREC. *
A* This file contains one record for each employee *
A* of the company. *
A*****************************************************************
A*
A R EMPREC
A ENUM 5 0 TEXT('EMPLOYEE NUMBER')
A ENAME 20 TEXT('EMPLOYEE NAME')
A ETYPE 1 TEXT('EMPLOYEE TYPE')
A EDEPT 3 0 TEXT('EMPLOYEE DEPARTMENT')
A ENHRS 3 1 TEXT('EMPLOYEE NORMAL WEEK HOURS')
A K ENUM
Figure 144. DDS for database file EMPMST (physical file)
A*****************************************************************
A* DESCRIPTION: This is the DDS for the physical file TRWEEK. *
A* It contains one record format called RCWEEK. *
A* This file contains all weekly entries made to *
A* the time reporting system. *
A*****************************************************************
A*
A R RCWEEK
A ENUM 5 0 TEXT('EMPLOYEE NUMBER')
A WEEKNO 2 0 TEXT('WEEK NUMBER OF CURRENT YEAR')
A EHWRK 4 1 TEXT('EMPLOYEE HOURS WORKED')
A K ENUM
A K WEEKNO
Figure 145. DDS for database file TRWEEK (physical file)
A*****************************************************************
A* RELATED FILES: EMPMST (Physical File) *
A* TRWEEK (Physical File) *
A* DESCRIPTION: This is the DDS for the logical file EMPL1. *
A* It contains two record formats called *
A* EMPREC and RCWEEK. *
A*****************************************************************
A R EMPREC PFILE(EMPMST)
A K ENUM
A*
A R RCWEEK PFILE(TRWEEK)
A K ENUM
A K WEEKNO
Figure 146. DDS for database file EMPL1 (logical file)
EXAMPLE PROGRAM 1 (Sequential-by-Key Using Primary File):
In this
example, the employee master record (EMPREC) and the weekly hours worked
record (RCWEEK) are contained in the same logical file EMPL1. The EMPL1 file is
defined as a primary input file and is read sequentially by key. In the data
description specifications for the file, the key for the EMPREC record is defined as
the ENUM (employee number) field, and the key for the RCWEEK record is defined
294 ILE RPG for AS/400 Programmer's Guide