ibm-information-center/dist/eclipse/plugins/i5OS.ic.rbam6_5.4.0.1/rbam6addr.htm

73 lines
4.3 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="%ADDRESS built-in function" />
<meta name="abstract" content="The address built-in function (%ADDRESS or %ADDR) can be used to change or test the memory address stored in a CL pointer variable and can only be used within a CL procedure." />
<meta name="description" content="The address built-in function (%ADDRESS or %ADDR) can be used to change or test the memory address stored in a CL pointer variable and can only be used within a CL procedure." />
<meta name="DC.Relation" scheme="URI" content="contp.htm" />
<meta name="DC.Relation" scheme="URI" content="valuv.htm" />
<meta name="DC.Relation" scheme="URI" content="rbam6builtinfunc.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="rbam6addr" />
<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>%ADDRESS built-in function</title>
</head>
<body id="rbam6addr"><a name="rbam6addr"><!-- --></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">%ADDRESS built-in function</h1>
<div><p>The address built-in function (%ADDRESS or %ADDR) can be used to
change or test the memory address stored in a CL pointer variable and can
only be used within a CL procedure.</p>
<div class="section"><p>In a CHGVAR command, you can specify the %ADDRESS
function to change the value of a pointer variable. On the IF command, %ADDRESS
function can be specified on the COND parameter to check the value stored
in a pointer variable.</p>
<div class="p">The format of the address built-in function is:<pre>%ADDRESS(variable name)</pre>
or<pre>%ADDR(variable name)</pre>
</div>
<p>In the following example, pointer variable &amp;P1 is initialized
to the address of the first byte of character variable &amp;C1. Later in
the procedure, the pointer is checked using the %ADDRESS function to see if
it still points to &amp;C1 and, if not, resets &amp;P1 to the first byte of
CL variable &amp;C1 using the %ADDRESS function.</p>
<pre>PGM
DCL &amp;C1 *CHAR 10
DCL &amp;P1 *PTR ADDRESS(&amp;C1)
:
IF COND(&amp;P1 *NE %ADDRESS(&amp;C1)) +
THEN(CHGVAR &amp;P1 %ADDRESS(&amp;C1))
:
ENDPGM </pre>
<div class="note"><span class="notetitle">Note:</span> The %ADDRESS function cannot be used to store the address
offset stored in a pointer variable. To store the address offset in a pointer
variable, you need to use the %OFFSET built-in function.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="contp.htm" title="You can use commands to change the flow of logic within your CL procedure.">Control processing within a CL procedure</a></div>
</div>
<div class="reltasks"><strong>Related tasks</strong><br />
<div><a href="valuv.htm" title="You can change the value of a CL variable using the Change Variable (CHGVAR) command.">Change the value of a variable</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rbam6builtinfunc.htm" title="CL provides several built-in functions.">Built-in functions for CL</a></div>
</div>
</div>
<img src="./deltaend.gif" alt="End of change" /></body>
</html>