ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbmult_5.4.0.1/nodenameex.htm

83 lines
4.4 KiB
HTML

<?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="Examples of NODENAME with DB2 Multisystem" />
<meta name="abstract" content="Here gives an example about how to use the NODENAME function." />
<meta name="description" content="Here gives an example about how to use the NODENAME function." />
<meta name="DC.subject" content="scalar function, Open Query File (OPNQRYF) CL command, NODENAME, NODENAME scalar function, for Open Query File (OPNQRYF) CL command" />
<meta name="keywords" content="scalar function, Open Query File (OPNQRYF) CL command, NODENAME, NODENAME scalar function, for Open Query File (OPNQRYF) CL command" />
<meta name="DC.Relation" scheme="URI" content="scalarnodename.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="nodenameex" />
<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>Examples of NODENAME with DB2 Multisystem</title>
</head>
<body id="nodenameex"><a name="nodenameex"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples of NODENAME with DB2<sup>®</sup> Multisystem</h1>
<div><p>Here gives an example about how to use the NODENAME function.</p>
<div class="section"> <ul><li>Find the node name and the partition number for every row of the EMPLOYEE
table, and the corresponding value of the EMPNO columns for each row. <div class="p">SQL
statement: <pre>SELECT NODENAME(CORPDATA.EMPLOYEE), PARTITION(CORPDATA.EMPLOYEE), EMPNO
FROM CORPDATA.EMPLOYEE</pre>
</div>
</li>
<li>Find the node name for every record of the EMPLOYEE table. <div class="p">OPNQRYF
command: <pre>OPNQRYF FILE((CORPDATA/EMPLOYEE))
FORMAT(FNAME)
MAPFLD((NODENAME '%NODENAME(1)'))</pre>
</div>
</li>
<li>Join the EMPLOYEE and DEPARTMENT tables, select the employee number (EMPNO)
and determine the node from which each row involved in the join originated.
<div class="p">SQL statement: <pre>SELECT EMPNO, NODENAME(X), NODENAME(Y)
FROM CORPDATA.EMPLOYEE X, CORPDATA.DEPARTMENT Y
WHERE X.DEPTNO=Y.DEPTNO</pre>
</div>
<div class="p">OPNQRYF command: <pre>OPNQRYF FILE((CORPDATA/EMPLOYEE) (CORPDATA/DEPARTMENT))
FORMAT(FNAME)
JFLD((EMPLOYEE/DEPTNO DEPARTMENT/DEPTNO *EQ))
MAPFLD((EMPNO 'EMPLOYEE/EMPNO')
(NODENAME1 '%NODENAME(1)')
(NODENAME2 '%NODENAME(2)'))</pre>
</div>
</li>
<li>Join the EMPLOYEE and DEPARTMENT tables, select all rows of the result
where the rows of the two tables are on the same node. <div class="p">SQL statement:
<pre>SELECT *
FROM CORPDATA.EMPLOYEE X, CORPDATA.DEPARTMENT Y
WHERE NODENAME(X)=NODENAME(Y)</pre>
</div>
<div class="p">OPNQRYF command:
<pre>OPNQRYF FILE((CORPDATA/EMPLOYEE) (CORPDATA/DEPARTMENT))
FORMAT(FNAME)
JFLD((1/NODENAME1 2/NODENAME2 *EQ))
MAPFLD((NODENAME1 '%NODENAME(1)')
(NODENAME2 '%NODENAME(2)'))</pre>
</div>
</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="scalarnodename.htm" title="Through the NODENAME function, you can determine the name of the relational database (RDB) where a specific row of the distributed relational database is stored.">NODENAME with DB2 Multisystem</a></div>
</div>
</div>
</body>
</html>