Sign in

docs DDS Physical

Example 1: Specifying the key field

Example: Specifying the key field for physical files

Example 1: Specifying the key field

In this example, a logical file views records of two physical files through two different record formats: CLSHST (class history) and JOBHST (job history).

In the logical file, the records from the two physical files can be merged together and sequenced by employee identification number (EMPNBR) by specifying EMPNBR in key position 1.

Figure 1. Specifying the key field

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R CLSHST                    PFILE(CLSHSTP)
00020A          K EMPNBR  1
00030A          K CLSDTE  2
00040A*
00050A          R JOBHST                    PFILE(JOBHSTP)
00060A          K EMPNBR  1
00070A          K JOBDTE  2
     A
Record formatKey positions
12
CLSHSTEMPNBRCLSDTE
JOBHSTEMPNBRJOBDTE

All records that have the same key value for EMPNBR pertain to the same employee. To merge and sequence all records for a given employee into a single history of classes and job assignments, specify CLSDTE (date of class) and JOBDTE (date of job assignment) in key position 2 for the two record formats, as shown in the Using *NONE in the key field when creating a DDS file topic.

Suppose that the job assignment dates and class dates are the dates (month/year) that the class or assignment started. Records for three students are retrieved in the following order:

EMPNBRCLSDTEJOBDTEDescription
10053/79Completed class
10054/79Left to begin new job
10054/79Completed job
10056/79Completed class
10061/79Completed job
10062/79Completed job
10063/79Completed class
10065/79Transferred to new location
10071/79Completed job
10074/79Completed job
10077/79Completed job
10078/79Left because of illness

The above report provides a continuous history for each student.