ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzalf_5.4.0.1/rzalfcallile.htm

129 lines
8.3 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="task" />
<meta name="DC.Title" content="Call ILE procedures" />
<meta name="abstract" content="You can follow the instructions in this topic to prepare and call ILE procedures from your i5/OS PASE programs." />
<meta name="description" content="You can follow the instructions in this topic to prepare and call ILE procedures from your i5/OS PASE programs." />
<meta name="DC.Relation" scheme="URI" content="rzalfamongpgms.htm" />
<meta name="DC.Relation" scheme="URI" content="rzalfcallileexamp.htm" />
<meta name="DC.Relation" scheme="URI" content="rzalfheaders.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/pase_size_ilearglist.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/pase_build_ilearglist.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/pase__ileload.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/pase__ilesym.htm" />
<meta name="DC.Relation" scheme="URI" content="../apis/pase__ilecall.htm" />
<meta name="DC.Relation" scheme="URI" content="../books/sc415606.pdf" />
<meta name="copyright" content="(C) Copyright IBM Corporation 2000, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2000, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzalfcallile" />
<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>Call ILE procedures</title>
</head>
<body id="rzalfcallile"><a name="rzalfcallile"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Call ILE procedures</h1>
<div><p>You can follow the instructions in this topic to prepare and call
ILE procedures from your <span class="keyword">i5/OS™</span> PASE
programs.</p>
<div class="p"><p>When you call ILE procedures from your <span class="keyword">i5/OS</span> PASE
programs, you should first prepare the procedure by enabling it for teraspace,
converting text to the appropriate CCSID, and setting up variables and structures.</p>
<ul><li><strong>Enable ILE procedures for teraspace</strong><p>All ILE modules that you
call from <span class="keyword">i5/OS</span> PASE must
be compiled with the teraspace option set to *YES. If your ILE modules are
not compiled in this way, you will receive the MCH4433 error message (<tt class="sysout">Invalid
storage model for target program &amp;2</tt>) in the job log for
your <span class="keyword">i5/OS</span> PASE application.</p>
</li>
<li><strong>Convert text to appropriate CCSID</strong><p>Text being passed between ILE
and <span class="keyword">i5/OS</span> PASE might need
to be converted to the appropriate CCSIDs before being passed. Not doing such
conversions causes your character variables to contain undecipherable values.</p>
</li>
<li><strong>Set up variables and structures</strong><div class="p">To make calls to ILE from your <span class="keyword">i5/OS</span> PASE programs, you need to
set up variables and structures. You must ensure that the required header
files are copied to your AIX<sup>®</sup> system, and you must set up a signature, a result
type, and an argument list variable:<ul><li><strong>Header files:</strong> Your <span class="keyword">i5/OS</span> PASE
program should include the header files as400_types.h and as400_protos.h to
make calls to ILE. The as400_type.h header file contains the definition of
the types used for i5/OS system-unique interfaces.</li>
<li><strong>Signature:</strong> The signature structure contains a description of the
sequence and types of arguments passed between <span class="keyword">i5/OS</span> PASE
and ILE. The encoding for the types mandated by the ILE procedure that you
are calling can be found in the as400_types.h header file. If a signature
contains fixed-point arguments shorter than 4 bytes or floating point arguments
shorter than 8 bytes, your ILE C code needs to be compiled with the following
pragma: <pre>#pragma argument(ileProcedureName, nowiden)</pre>
<p>Without
this pragma, standard C linking for ILE requires 1- and 2-byte integer arguments
to be widened to 4 bytes and requires 4-byte floating-point arguments to be
widened to 8 bytes.</p>
</li>
<li><strong>Result type:</strong> The result type is straightforward and works much
like a return type in C.</li>
<li><strong>Argument list:</strong> The argument list must be a structure with the correct
sequence of fields with types specified by entries in the signature array.
You can use the size_ILEarglist() and build_ILEarglist() APIs to dynamically
build the argument list based on the signature.</li>
</ul>
</div>
</li>
</ul>
</div>
<div class="section">To call ILE procedures from your <span class="keyword">i5/OS</span> PASE
programs, make the following API calls in your code:</div>
<ol><li class="stepexpand"><span>Load the bound program into the ILE activation group that is associated
with the procedure that started <span class="keyword">i5/OS</span> PASE.
You use the _ILELOAD() API to do this.</span> <p>This step can be unnecessary
if the bound program is already active in the activation group that started <span class="keyword">i5/OS</span> PASE. In this case, you can
proceed to the _ILESYM step, using a value of zero for the activation mark
parameter to search all symbols in all active bound programs in the current
activation group.</p>
</li>
<li class="stepexpand"><span>Find the exported symbol in the activation
of the ILE bound program and return a 16-byte tagged pointer to the data or
procedure for the symbol. You use the _ILESYM() API to do this.</span></li>
<li class="stepexpand"><span>Call the ILE procedure to transfer control
from your <span class="keyword">i5/OS</span> PASE program
to the ILE procedure. You use the _ILECALL() or _ILECALLX() API to do this.</span></li>
</ol>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rzalfcallileexamp.htm">Examples: Call ILE procedures</a></strong><br />
The code examples in this topic show i5/OS PASE code making a call to an ILE
procedure that is part of a service program and the compiler commands that
create the programs.</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzalfamongpgms.htm" title="i5/OS PASE provides methods for calling ILE procedures, Java programs, OPM programs, i5/OS APIs, and CL commands that give you integrated access to i5/OS functions.">Call i5/OS programs and procedures from your i5/OS PASE programs</a></div>
</div>
<div class="relref"><strong>Related reference</strong><br />
<div><a href="rzalfheaders.htm" title="You can follow the instructions in this topic to copy header files from your iSeries server to an AIX machine.">Copy header files</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../apis/pase_size_ilearglist.htm">size_ILEarglist()--Compute ILE Argument List Size for i5/OS PASE()</a></div>
<div><a href="../apis/pase_build_ilearglist.htm">build_ILEarglist()--Build an ILE Argument List for i5/OS PASE</a></div>
<div><a href="../apis/pase__ileload.htm">_ILELOADX()--Load an ILE Bound Program for i5/OS PASE</a></div>
<div><a href="../apis/pase__ilesym.htm">_ILESYMX()--Find an Exported ILE Symbol for i5/OS PASE</a></div>
<div><a href="../apis/pase__ilecall.htm">_ILECALLX()--Call an ILE Procedure for i5/OS PASE</a></div>
<div><a href="../books/sc415606.pdf" target="_blank">ILE Concepts PDF</a></div>
</div>
</div>
</body>
</html>