79 lines
5.7 KiB
HTML
79 lines
5.7 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="concept" />
|
|
<meta name="DC.Title" content="Use the Open Query File (OPNQRYF) command for more than just input" />
|
|
<meta name="abstract" content="The Open Query File (OPNQRYF) command supports the OPTION parameter to determine the type of processing. The default is OPTION(*INP), so the file is opened for input only. You can also use other OPTION values on the OPNQRYF command and a high-level language program to add, update, or delete records through the open query file." />
|
|
<meta name="description" content="The Open Query File (OPNQRYF) command supports the OPTION parameter to determine the type of processing. The default is OPTION(*INP), so the file is opened for input only. You can also use other OPTION values on the OPNQRYF command and a high-level language program to add, update, or delete records through the open query file." />
|
|
<meta name="DC.subject" content="Open Query File (OPNQRYF) command, using, for more than just input, OPNQRYF (Open Query File) command, for more than just input" />
|
|
<meta name="keywords" content="Open Query File (OPNQRYF) command, using, for more than just input, OPNQRYF (Open Query File) command, for more than just input" />
|
|
<meta name="DC.Relation" scheme="URI" content="rbafoopnqf.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="rbafoopenm" />
|
|
<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>Use the Open Query File (OPNQRYF) command for more than just input</title>
|
|
</head>
|
|
<body id="rbafoopenm"><a name="rbafoopenm"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Use the Open Query File (OPNQRYF) command for more than just input</h1>
|
|
<div><p>The Open Query File (OPNQRYF) command supports the OPTION parameter
|
|
to determine the type of processing. The default is OPTION(*INP), so the file
|
|
is opened for input only. You can also use other OPTION values on the OPNQRYF
|
|
command and a high-level language program to add, update, or delete records
|
|
through the open query file. </p>
|
|
<p> However, if you specify the UNIQUEKEY, GRPFLD, or GRPSLT parameter, use
|
|
one of the aggregate functions, or specify multiple files on the FILE parameter,
|
|
your use of the file is restricted to input only.</p>
|
|
<p>A join logical file is limited to input-only processing. A view is limited
|
|
to input-only processing, if group, join, union, distinct processing, or a
|
|
user-defined table function is specified in the definition of the view. If
|
|
the query optimizer needs to create a temporary file to implement the query,
|
|
then the use of the file is restricted to input only.</p>
|
|
<div class="p">If you want to change a field value from the current value to a different
|
|
value in some of the records in a file, you can use a combination of the OPNQRYF
|
|
command and a specific high-level language program. For example, assume that
|
|
you want to change all the records where the <em>Flda</em> field is equal to
|
|
ABC so that the <em>Flda</em> field is equal to XYZ. You can specify: <pre>OVRDBF FILE(FILEA) SHARE(*YES)
|
|
OPNQRYF FILE(FILEA) OPTION(*ALL) QRYSLT('FLDA *EQ "ABC" ')
|
|
CALL PGM(PGMA)
|
|
CLOF OPNID(FILEA)
|
|
DLTOVR FILE(FILEA)</pre>
|
|
</div>
|
|
<p>Program PGMA processes all records it can read, but the query selection
|
|
restricts these to records where the <em>Flda</em> field is equal to ABC. The
|
|
program changes the field value in each record to XYZ and updates the record.</p>
|
|
<div class="p">You can also delete records in a database file using the OPNQRYF command.
|
|
For example, assume that you have a field in your record that,
|
|
if equal to X, means the record should be deleted. Your program can be written
|
|
to delete any records it reads and use the OPNQRYF command to select those
|
|
to be deleted such as: <pre>OVRDBF FILE(FILEA) SHARE(*YES)
|
|
OPNQRYF FILE(FILEA) OPTION(*ALL) QRYSLT('DLTCOD *EQ "X" ')
|
|
CALL PGM(PGMB)
|
|
CLOF OPNID(FILEA)
|
|
DLTOVR FILE(FILEA)</pre>
|
|
</div>
|
|
<p>You can also add records by using the OPNQRYF command. However, if the
|
|
query specifications include selection values, your program can be prevented
|
|
from reading the added records because of the selection values.</p>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafoopnqf.htm" title="The Open Query File (OPNQRYF) command is a control language (CL) command that allows you to perform many data processing functions on database files. These topics discuss how to create a query using the OPNQRYF command, how to specify parameters for its major functions, and how to use it with your high-level language program.">Use Open Query File (OPNQRYF) command</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |