ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/conPassParm.htm

82 lines
4.9 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="Passing parameters" />
<meta name="abstract" content="In an OPM or ILE call, a parameter is an expression that represents a value that the calling application passes to the API specified in the call." />
<meta name="description" content="In an OPM or ILE call, a parameter is an expression that represents a value that the calling application passes to the API specified in the call." />
<meta name="DC.Relation" scheme="URI" content="conParameter.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="conPassParm" />
<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>Passing parameters</title>
</head>
<body id="conPassParm"><a name="conPassParm"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Passing parameters</h1>
<div><p>In an OPM or ILE call, a parameter is an expression that represents
a value that the calling application passes to the API specified in the call.</p>
<p>HLL languages use the following methods for passing parameters:</p>
<dl><dt class="dlterm"><em>By value, directly</em></dt>
<dd> <p>The value of the data object is placed directly into the parameter
list.</p>
</dd>
<dt class="dlterm"><em>By value, indirectly</em></dt>
<dd> <p>The value of the data object is copied to a temporary location. The
address of the copy (a pointer) is placed into the parameter list. By value,
indirectly is not done explicitly by the application programmer. It is done
by the operating system at run time.</p>
</dd>
<dt class="dlterm"><em>By reference</em></dt>
<dd> <p>A pointer to the data object is placed into the parameter list. Changes
made by the called API to the parameter are reflected in the calling application.</p>
</dd>
</dl>
<p>When you call an API, the protocol for passing parameters is to typically
pass a space pointer that points to the information being passed. (This is
also referred to as pass-by-reference.) This is the convention used by the
control language (CL), RPG, and COBOL compilers. Care must be used in those
languages that support pass-by-value (such as ILE C) to ensure that these
conventions are followed. Refer to the appropriate language documentation
for instructions. The parameter passing convention of pass-by-reference can
be used in all programming languages. Some of the UNIX-type APIs require pass-by-value
parameter passing. VisualAge<sup>®</sup> C++ for <span class="keyword">i5/OS™</span> also
supports pass-by-value parameter passing.</p>
<p>HLL semantics usually determine when data is passed by value and when it
is passed by reference. For example, ILE C passes and accepts parameters by
value, directly, while for OPM and ILE COBOL and OPM and ILE RPG parameters
are usually passed by reference. You must ensure that the calling program
or procedure passes parameters in the manner expected by the called API. The
OPM or ILE HLL programmer's guides contain more information on passing parameters
to different languages.</p>
<p>The ILE languages support the following parameter-passing styles:</p>
<ul><li>ILE C passes and accepts parameters by value (directly and indirectly)
and by reference.</li>
<li>ILE COBOL supports the passing of parameters by value (indirectly) and
by reference.</li>
<li>ILE RPG supports the passing of parameters by value (directly and indirectly)
and by reference.</li>
<li>ILE CL supports the passing of parameters by reference.</li>
</ul>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="conParameter.htm" title="After you have found the API that you want to use, you need to code a call to an API and pass to the API the required set of parameters appropriate for that API.">API parameters</a></div>
</div>
</div>
</body>
</html>