Specify the key field (example 2)

In this example, a logical file views the same two physical files as in Example 1, but the second record format in the logical file has *NONE specified in key position 2.

Figure 1. Specify the key field (example 2)
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R CLSHST                    PFILE(CLSHSTP)
00020A          K EMPNBR  1
00030A          K CLSDTE  2
00040A*
00050A*
00060A          R JOBHST                    PFILE(JOBHSTP)
00070A          K EMPNBR  1
00080A          K *NONE   2
00090A          K JOBDTE  3
     A
Record format Key positions    
  1 2 3
CLSHST EMPNBR CLSDTE *NONE
JOBHST EMPNBR *NONE JOBDTE

As in the example in the Using *NONE in the key field when creating a DDS file topic, all records from the two physical files are first merged and sequenced together on employee number (EMPNBR). However, the records for each student are merged and sequenced first on class date (CLSDTE) and then on job assignment date (JOBDTE). The set of records used for that example are now retrieved as follows:

EMPNBR CLSDTE JOBDTE Description
1005 3/79   Completed class
1005 4/79   Left to begin new job
1005 6/79   Completed class
1005   4/79 Completed job
1006 3/79   Completed class
1006 5/79   Transferred to new location
1006   1/79 Completed job
1006   2/79 Completed job
1007 8/79   Left because of illness
1007   1/79 Completed job
1007   4/79 Completed job
1007   7/79 Completed job

When several adjacent record formats have *NONE in the same key position, they form a set, relative to record formats specified before and after them, that functions in sequencing as an individual record format. Key fields specified after *NONE serve to merge and sequence records of the formats within the set. The following example shows how several record formats function as a set.

Related concepts
Use *NONE in the key field when creating a DDS file