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

138 lines
8.4 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="Restricted built-in functions" />
<meta name="abstract" content="Listed here are several restricted built-in functions." />
<meta name="description" content="Listed here are several restricted built-in functions." />
<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="rbaforbif" />
<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>Restricted built-in functions</title>
</head>
<body id="rbaforbif"><a name="rbaforbif"><!-- --></a>
<img src="./delta.gif" alt="Start of change" /><!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Restricted built-in functions</h1>
<div><p>Listed here are several restricted built-in functions.</p>
<div class="section"><div class="p">The following built-in function is supported only as the second
operand of the 'equal' or 'not-equal' relational operators specified on the
QRYSLT or GRPSLT parameter.<dl><dt class="dlterm">%NULL</dt>
<dd>%NULL accepts no arguments. It is used to select or omit records based
on whether a field in the record contains a null value. <div class="p">Example:<pre>OPNQRYF
FILE(library/file)
QRYSLT('charfld = %NULL')</pre>
</div>
<p>This query would select all the records where 'charfld'
contains the null value.</p>
</dd>
</dl>
</div>
<div class="p">The following three built-in functions are supported
only as the second operand of the 'equal' relational operator specified on
the QRYSLT or GRPSLT parameter.<dl><dt class="dlterm">%RANGE (low-value high-value)</dt>
<dd>%RANGE is used to identify the lower and upper boundaries for the value
of a field or expression. %RANGE must be specified as the right side of a
relation whose operator is equal. The low-value and high-value argument must
be field names, character strings, or numeric literals, to match the type
of field or expression specified as left side of the relation. For example,
to select only records where the numeric field NBRFLD has a value ranging
from 10 through 20, specify as follows: <p><samp class="codeph"> 'nbrfld = %RANGE(10 20)' </samp></p>
<p>If
the low-value argument is greater than the high-value argument, the relation
produces a logical value of 'false'.</p>
</dd>
<dt class="dlterm">%VALUES (allowed-value...)</dt>
<dd>%VALUES is used to identify a list of allowed values for a field or expression.
%VALUES must be specified as the right side of a relation whose operator is
equal. The allowed-value arguments must be character string or numeric literals,
to match the type of the field or expression specified as the left side of
the relation. For example, to select only records where the second character
of field CHARFLD has a value that is one of the values 'A', 'E', 'I', 'O',
or 'U', specify as follows:<p><samp class="codeph">'%SST(charfld 2 1) = %VALUES(''A''
''E'' ''I'' ''O'' ''U'')'</samp></p>
</dd>
<dt class="dlterm">%WLDCRD (''pattern-string'' ''wild-characters'')</dt>
<dd>%WLDCRD is used to specify a pattern that performs a wildcard scan of
the character or hexadecimal field or string expression (except for expressions
made up of a single character-string literal) that must be specified as the
left side of the relation. %WLDCRD must be specified as the right side of
a relation whose operator is equal. The pattern-string argument must be a
character-string, DBCS, or graphic literal, to match the left side of the
relation. The wild-characters argument is an optional parameter that specifies
what 'wildcard' characters are used in the pattern-string. <p>If specified
for character data only (no DBCS data), the wild-characters argument must
be a character-string literal of exactly two characters. The first character
is the value that matches any single character in the search string. The second
character is the value that matches a substring of any zero or more characters.
The two characters must not be the same, but there is no requirement that
either character appear in the pattern-string. If the wild-characters argument
is omitted, the default is for an underline ('_') to match any single character
and an asterisk ('*') to match a substring of any zero or more characters.</p>
<p>If
the wild-characters argument is specified for DBCS data only (no character
data), the argument must be a double-byte character-string literal of exactly
two double-byte characters. The first double-byte character is the value that
will match any one double-byte character in the search string. The second
double-byte character is the value that will match a substring of any zero
or more characters. The two double-byte characters must not be the same, but
there is no requirement that either character appear in the pattern string.
If the wild-characters argument is omitted, the default is for a DBCS underline
to match any one double-byte character and a DBCS asterisk to match a substring
of any zero or more double-byte characters.</p>
<p>If the wild-characters argument
is specified for both character and DBCS data, in addition to the previous
rules, the argument must first contain a single-byte character-string literal
(two single-byte characters), then a double-byte character string (two double-byte
characters).</p>
<p>In this case, the first character matches any single-byte
character in the character string, the second character matches a substring
of any number of single-byte or double-byte characters. The first double-byte
character matches any double-byte character in the character string. The second
double-byte character matches a substring of any number of single-byte or
double-byte characters.</p>
<p>The following example selects only records where
the character field CHARFLD contains a 'T', followed by any two characters
and an 'E', appearing anywhere in the field.</p>
<p><samp class="codeph">'charfld = %WLDCRD(''*T__E*'')'</samp></p>
<div class="note"><span class="notetitle">Note:</span> The
asterisks at the start and end of the pattern-string are required to allow
the 'T' and 'E' to appear somewhere other than the first and last positions
in the field:</div>
<p>To select only records where the character field CHARFLD
starts with the string 'ABC', followed by one or more other characters and
then followed by the string 'XYZ' (but not necessarily at the end of the field),
specify the following.</p>
<p><samp class="codeph">'charfld = %WLDCRD(''ABC_*XYZ*'')'</samp></p>
<p>To
select only records where the second character of field CHARFLD is an asterisk
('*'), the last character is an underline ('_'), and the letter 'M' appears
somewhere in between, specify as follows:</p>
<p><samp class="codeph">'charfld = %WLDCRD(''#*.M._''
''#.'')'</samp></p>
</dd>
</dl>
</div>
</div>
</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>
<img src="./deltaend.gif" alt="End of change" /></body>
</html>