<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html lang="en-us" xml:lang="en-us"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="security" content="public" /> <meta name="Robots" content="index,follow" /> <meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' /> <meta name="DC.Type" content="concept" /> <meta name="DC.Title" content="Handle missing records in secondary join files" /> <meta name="abstract" content="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." /> <meta name="description" content="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." /> <meta name="DC.subject" content="secondary file, handling missing records in join, example, Handling missing records in secondary join files" /> <meta name="keywords" content="secondary file, handling missing records in join, example, Handling missing records in secondary join files" /> <meta name="DC.Relation" scheme="URI" content="rbafodynrs.htm" /> <meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" /> <meta name="DC.Format" content="XHTML" /> <meta name="DC.Identifier" content="rbafomrsjf" /> <meta name="DC.Language" content="en-us" /> <!-- All rights reserved. Licensed Materials Property of IBM --> <!-- US Government Users Restricted Rights --> <!-- Use, duplication or disclosure restricted by --> <!-- GSA ADP Schedule Contract with IBM Corp. --> <link rel="stylesheet" type="text/css" href="./ibmdita.css" /> <link rel="stylesheet" type="text/css" href="./ic.css" /> <title>Handle missing records in secondary join files</title> </head> <body id="rbafomrsjf"><a name="rbafomrsjf"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Handle missing records in secondary join files</h1> <div><p>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.</p> <div class="section" id="rbafomrsjf__rbafomrsjfex1"><a name="rbafomrsjf__rbafomrsjfex1"><!-- --></a><h4 class="sectiontitle">Example: Handle missing records in secondary join file</h4><p>This example shows how to read records from the primary file that do not have a record in the secondary file.</p> <div class="p">In <a href="rbafodynjfex1.htm#rbafodynjfex1">Example 1: Dynamically join database files without DDS</a>, the JDFTVAL parameter is not specified, so the only records read are the result of a successful join from FILEA to FILEB. If you want a list of the records in FILEA that do not have a match in FILEB, you can specify *ONLYDFT on the JDFTVAL parameter as shown in the this example: <pre>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)</pre> </div> <p>JDFTVAL(*ONLYDFT) causes a record to be returned to the program only when there is no equivalent record in the secondary file (FILEB).</p> <p>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.</p> <div class="p">Conversely, you can also get a list of all the records where there is a record in FILEB that does not have a match in FILEA. You can do this by making the secondary file the primary file in all the specifications. You can specify: <pre>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)</pre> <div class="note"><span class="notetitle">Note:</span> The Override with Database File (OVRDBF) command in this example uses FILE(FILEB) because it must specify the first file on the FILE parameter of the Open Query File (OPNQRYF) command. The Close File (CLOF) command also names FILEB. The JFLD and MAPFLD parameters are also changed. The program is created using FILEB.</div> </div> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodynrs.htm" title="Dynamic record selection allows you to request a subset of the records in a file without using data description specifications (DDS).">Select records without using DDS</a></div> </div> </div> </body> </html>