<?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="reference" /> <meta name="DC.Title" content="Example 3: Dynamically join database files without DDS" /> <meta name="abstract" content="This example shows how to use mapped fields as join fields when dynamically joining database files without DDS." /> <meta name="description" content="This example shows how to use mapped fields as join fields when dynamically joining database files without DDS." /> <meta name="DC.Relation" scheme="URI" content="rbafodynjf.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="rbafodynjfex3" /> <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>Example 3: Dynamically join database files without DDS</title> </head> <body id="rbafodynjfex3"><a name="rbafodynjfex3"><!-- --></a> <!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script> <h1 class="topictitle1">Example 3: Dynamically join database files without DDS</h1> <div><p>This example shows how to use mapped fields as join fields when dynamically joining database files without DDS.</p> <div class="section"><div class="p">You can use fields defined on the MAPFLD parameter for either one of the join field pairs. This is useful when the key in the secondary file is defined as a single field (for example, a 6-character date field) and there are separate fields for the same information (for example, month, day, and year) in the primary file. Assume that FILEA has character fields <em>Year, Month</em>, and <em>Day</em> and needs to be joined to FILEB which has the <em>Date</em> field in YYMMDD format. Assume that you have defined file JOINAB with the required format. You can specify: <pre>OVRDBF FILE(JOINAB) TOFILE(FILEA) SHARE(*YES) OPNQRYF FILE(FILEA FILEB) FORMAT(JOINAB) + JFLD((YYMMDD FILEB/DATE)) + MAPFLD((YYMMDD 'YEAR *CAT MONTH *CAT DAY')) CALL PGM(PGME) /* Created using file JOINAB as input */ CLOF OPNID(FILEA) DLTOVR FILE(JOINAB)</pre> </div> </div> <div class="section"><p>The MAPFLD parameter defines the <em>YYMMDD</em> field as the concatenation of several fields from FILEA. You do not need to specify field attributes (for example, length or type) for the <em>YYMMDD</em> field on the MAPFLD parameter because the system calculates the attributes from the expression.</p> </div> </div> <div> <div class="familylinks"> <div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodynjf.htm" title="The dynamic join function allows you to join files without having to first specify data description specifications (DDS) and create a join logical file.">Dynamically join database files without DDS</a></div> </div> </div> </body> </html>