89 lines
4.8 KiB
HTML
89 lines
4.8 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="Example 2: Define fields derived from existing field definitions" />
|
||
<meta name="abstract" content="This example shows the use of built-in functions." />
|
||
<meta name="description" content="This example shows the use of built-in functions." />
|
||
<meta name="DC.Relation" scheme="URI" content="rbafofdefd.htm" />
|
||
<meta name="DC.Relation" scheme="URI" content="../rbam6/rbam6clmain.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="rbafofdefdex2" />
|
||
<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 2: Define fields derived from existing field definitions</title>
|
||
</head>
|
||
<body id="rbafofdefdex2"><a name="rbafofdefdex2"><!-- --></a>
|
||
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
<h1 class="topictitle1">Example 2: Define fields derived from existing field definitions</h1>
|
||
<div><p>This example shows the use of built-in functions.</p>
|
||
<div class="section"><p>Assume that you want to calculate a mathematical
|
||
function that is the sine of the <em>Fldm</em> field in FILEA. First create
|
||
a file (assume it is called FILEAA) with a record format containing the following
|
||
fields:</p>
|
||
</div>
|
||
|
||
<table cellpadding="4" cellspacing="0" border="1" class="tableborder"><tr><td>
|
||
<table cellpadding="4" cellspacing="0" summary="" width="100%" border="0"><thead align="left"><tr><th align="left" valign="bottom" width="50%" id="d0e27">FILEA</th>
|
||
<th align="left" valign="bottom" width="50%" id="d0e29">FILEAA</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody><tr><td align="left" valign="top" width="50%" headers="d0e27 ">Code</td>
|
||
<td align="left" valign="top" width="50%" headers="d0e29 ">Code</td>
|
||
</tr>
|
||
<tr><td align="left" valign="top" width="50%" headers="d0e27 ">Fldm</td>
|
||
<td align="left" valign="top" width="50%" headers="d0e29 ">Fldm</td>
|
||
</tr>
|
||
<tr><td align="left" valign="top" width="50%" headers="d0e27 "> </td>
|
||
<td align="left" valign="top" width="50%" headers="d0e29 ">Sinm</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</td></tr></table>
|
||
<div class="section"><div class="p">You can then create a program (assume PGMF) using FILEAA as input
|
||
and specify: <pre>OVRDBF FILE(FILEAA) TOFILE(FILEA) SHARE(*YES)
|
||
OPNQRYF FILE(FILEA) FORMAT(FILEAA) +
|
||
MAPFLD((SINM '%SIN(FLDM)'))
|
||
CALL PGM(PGMF) /* Created using file FILEAA as input */
|
||
CLOF OPNID(FILEA)
|
||
DLTOVR FILE(FILEAA)</pre>
|
||
</div>
|
||
</div>
|
||
<div class="section"><p>The built-in function %SIN calculates the sine of the field specified
|
||
as its argument. Because the <em>Sinm</em> field is defined in the format specified
|
||
on the FORMAT parameter, the Open Query File (OPNQRYF) command converts its
|
||
internal definition of the sine value (in floating point) to the definition
|
||
of the <em>Sinm</em> field. This technique can be used to avoid certain high-level
|
||
language restrictions regarding the use of floating-point fields. For example,
|
||
if you defined the <em>Sinm</em> field as a packed decimal field, PGMF can be
|
||
written using any high-level language, even though the value was built using
|
||
a floating-point field.</p>
|
||
</div>
|
||
<div class="section"><p>There are many other functions besides sine that can be used.
|
||
See the OPNQRYF command in the Control language (CL) topic for a complete
|
||
list of built-in functions.</p>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafofdefd.htm" title="Listed here are the operations allowed by defining fields derived from existing field definitions.">Define fields derived from existing field definitions</a></div>
|
||
</div>
|
||
<div class="relconcepts"><strong>Related concepts</strong><br />
|
||
<div><a href="../rbam6/rbam6clmain.htm">Control language (CL)</a></div>
|
||
</div>
|
||
</div>
|
||
</body>
|
||
</html> |