ibm-information-center/dist/eclipse/plugins/i5OS.ic.dbp_5.4.0.1/rbafodynsrex10.htm

81 lines
5.1 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<?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 10: Select records using the Open Query File (OPNQRYF) command" />
<meta name="abstract" content="This example shows the use of the coded character set identifiers (CCSIDs) when you run the Open Query File (OPNQRYF) command to select records." />
<meta name="description" content="This example shows the use of the coded character set identifiers (CCSIDs) when you run the Open Query File (OPNQRYF) command to select records." />
<meta name="DC.Relation" scheme="URI" content="rbafodynsrsex.htm" />
<meta name="DC.Relation" scheme="URI" content="../nls/rbagsglobalmain.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="rbafodynsrex10" />
<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 10: Select records using the Open Query File (OPNQRYF) command</title>
</head>
<body id="rbafodynsrex10"><a name="rbafodynsrex10"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example 10: Select records using the Open Query File (OPNQRYF) command</h1>
<div><p>This example shows the use of the coded character set identifiers
(CCSIDs) when you run the Open Query File (OPNQRYF) command to select records.</p>
<div class="section"><div class="p">Each character and DBCS field in all database files is tagged
with a CCSID. This CCSID allows you to further define the data stored in the
file so that any comparison, join, or display of the fields is performed in
a meaningful way. For example, if you compare FIELD1 in FILE1 where FIELD1
has a CCSID of 37 (USA) to FIELD2 in FILE2 where FILED2 has a CCSID of 273
(Austria, Germany), appropriate mapping occurs to make the comparison meaningful. <pre>OPNQRYF FILE(FILEA FILEB) FORMAT(RESULTF) +
JFLD((FILEA/NAME FILEB/CUSTOMER))</pre>
</div>
</div>
<div class="section"><p>If field NAME has a CCSID of 37 and field CUSTOMER has a CCSID
of 273, the mapping of either NAME or CUSTOMER is performed during processing
of the OPNQRYF command so that the join of the two fields provides a meaningful
result.</p>
</div>
<div class="section"><p>Normally, constants defined in the MAPFLD, QRYSLT, and GRPSLT
parameters are tagged with the CCSID defined to the current job. This suggests
that when two users with different job CCSIDs run the same OPNQRYF command
(or a program containing an OPNQRYF command) and the OPNQRYF command has constants
defined in it, the users can get different results because the CCSID tagged
to the constants might cause the constants to be treated differently.</p>
</div>
<div class="section"><div class="p">You can tag a constant with a specific CCSID by using the MAPFLD
parameter. By specifying a MAPFLD whose definition consists only of a constant
and then specifying a CCSID for the MAPFLD, the constant becomes tagged with
the CCSID specified in the MAPFLD parameter. For example: <pre>OPNQRYF FILE(FILEA) FORMAT(RESULTF) QRYSLT('NAME *EQ MAP1') +
MAPFLD((MAP1 '"Smith"' *CHAR 5 *N 37))</pre>
</div>
</div>
<div class="section"><div class="p">The constant <span class="q">"Smith"</span> is tagged with the CCSID 37 regardless
of the job CCSID of the user issuing the OPNQRYF command. In this example,
all users get the same result records (although the result records
would be mapped to the user's job CCSID). Conversely, if the query is specified
as: <pre>OPNQRYF FILE(FILEA) FORMAT(RESULTF) QRYSLT('NAME *EQ "Smith"')</pre>
The
results of the query might differ, depending on the job CCSID of the user
issuing the OPNQRYF command.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafodynsrsex.htm" title="These topics provide examples of selecting records using the Open Query File (OPNQRYF) command.">Select records using the Open Query File (OPNQRYF) command</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="../nls/rbagsglobalmain.htm">i5/OS globalization</a></div>
</div>
</div>
</body>
</html>