The system allows you to control whether to allow defaults for missing records in secondary files (similar to the JDFTVAL DDS keyword for a join logical file). You can also specify that only records with defaults be processed. This allows you to select only those records in which there is a missing record in the secondary file.
This example shows how to read records from the primary file that do not have a record in the secondary file.
OVRDBF FILE(FILEA) SHARE(*YES) OPNQRYF FILE(FILEA FILEB) FORMAT(FILEA) + JFLD((CUST FILEB/CUST)) + MAPFLD((CUST 'FILEA/CUST')) + JDFTVAL(*ONLYDFT) CALL PGM(PGME) /* Created using file FILEA as input */ CLOF OPNID(FILEA) DLTOVR FILE(FILEA)
JDFTVAL(*ONLYDFT) causes a record to be returned to the program only when there is no equivalent record in the secondary file (FILEB).
Because any values returned by the join operation for the fields in FILEB are defaults, it is normal to use only the format for FILEA. The records that appear are those that do not have a match in FILEB. The FORMAT parameter is required whenever the FILE parameter describes more than a single file, but the file name specified can be one of the files specified on the FILE parameter. The program is created using FILEA.
OVRDBF FILE(FILEB) SHARE(*YES) OPNQRYF FILE(FILEB FILEA) FORMAT(FILEB) JFLD((CUST FILEA/CUST)) + MAPFLD((CUST 'FILEB/CUST')) JDFTVAL(*ONLYDFT) CALL PGM(PGMF) /* Created using file FILEB as input */ CLOF OPNID(FILEB) DLTOVR FILE(FILEB)