ibm-information-center/dist/eclipse/plugins/i5OS.ic.ddp_5.4.0.1/rbal1manipulating.htm

78 lines
5.3 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="task" />
<meta name="DC.Title" content="Manipulate data in tables and files using the iSeries query management function" />
<meta name="abstract" content="The i5/OS licensed program provides a DB2 Universal Database for iSeries query management function that allows you to manipulate data in tables and files. A query is created using an SQL query statement." />
<meta name="description" content="The i5/OS licensed program provides a DB2 Universal Database for iSeries query management function that allows you to manipulate data in tables and files. A query is created using an SQL query statement." />
<meta name="DC.subject" content="load data, using DB2 for, iSeries, DB2 for, loading data into tables" />
<meta name="keywords" content="load data, using DB2 for, iSeries, DB2 for, loading data into tables" />
<meta name="DC.Relation" scheme="URI" content="rbal1newdatatotables.htm" />
<meta name="DC.Relation" scheme="URI" content="../books/sc415703.pdf" />
<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="rbal1manipulating" />
<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>Manipulate data in tables and files using the iSeries query management function</title>
</head>
<body id="rbal1manipulating"><a name="rbal1manipulating"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Manipulate data in tables and files using the iSeries query management function</h1>
<div><p>The <span class="keyword">i5/OS™</span> licensed
program provides a <span class="keyword">DB2 Universal Database™ for iSeries™</span> query
management function that allows you to manipulate data in tables and files.
A query is created using an SQL query statement.</p>
<div class="section"> <p>You can run the query through CL commands or through a query
callable interface in your application program. Using the query management
function, you can insert a row of data into a table for the inventory updates
described in the <a href="rbal1tbldatasql.htm">Load data into a table using SQL</a> as follows.</p>
<p>Create
a source member INVLOAD in the source physical file INVLOAD and the SQL statement: </p>
<pre>INSERT INTO SPIFFY/INVENT
(PART, DESC, QTY, PRICE)
VALUES
(&amp;PARTVALUE, &amp;DESCVALUE, &amp;QTYVALUE, &amp;PRICEVALUE)</pre>
<p>Use
a CL command to create a query management query object: </p>
<pre>CRTQMQRY QMQRY(INVLOAD) SRCFILE(INVLOAD) SRCMBR(INVLOAD)</pre>
<p>The
following CL command places the INSERT SQL statement results into the INVENT
table in the SPIFFY collection. Use of variables in the query (&amp;PARTVALUE, &amp;DESCVALUE,
and so on) allows you to enter the desired values as part of the STRQMQRY
call, rather than requiring that you create the query management query again
for each row. </p>
<pre>STRQMQRY QMQRY(INVLOAD) RDB(KC000)
SETVAR((PARTVALUE '1134567'') (DESCVALUE '''Lug Nut''')
(QTYVALUE 25) (PRICEVALUE 1.15)) </pre>
<p>The query management function
is dynamic, which means its access paths are built at run time instead of
when a program is compiled. For this reason the DB2<sup>®</sup> UDB for <span class="keyword">iSeries</span> query
management function is not as efficient for loading data into a table as an
SQL application. However, you need the <span class="keyword">IBM<sup>®</sup> DB2 Query Manager and SQL Development Kit for iSeries</span> product
to write an application; runtime support for SQL and query management is part
of the <span class="keyword">i5/OS</span> licensed program.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbal1newdatatotables.htm" title="You load data into a table by entering each data item into the table. On the iSeries server, you can use SQL, the DB2 Universal Database for iSeries Query Management function, or the data file utility portion of iSeries Application Development Tools to create applications that insert data into a table.">Load new data into the tables of a distributed relational database</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="../books/sc415703.pdf " target="_blank">Query Management Programming PDF</a></div>
</div>
</div>
</body>
</html>