You can join a physical file to itself to read records that are formed by
combining two or more records from the physical file itself. The
following example shows how:

The following shows the DDS for these files:
JLF
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A JDFTVAL
A R JOINREC JFILE(PF1 PF1)
A J JOIN(1 2)
A JFLD(MGRNBR NBR)
A NBR JREF(1)
A NAME JREF(1)
A MGRNAME RENAME(NAME)
A JREF(2)
A
PF1
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A R RCD1
A NBR 3
A NAME 10 DFT('none')
A MGRNBR 3
A
Notes:
Assume the following records are contained in PF1:

The program reads the following logical file records:

Note that a record is returned for the manager name of Sue because the JDFTVAL keyword was specified. Also note that the value none is returned because the DFT keyword was used on the Name field in the PF1 physical file.