ibm-information-center/dist/eclipse/plugins/i5OS.ic.sqlp_5.4.0.1/rbafyexamplecall.htm

85 lines
5.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="Examples of CALL statements" />
<meta name="abstract" content="These examples show how the arguments of the CALL statement are passed to the procedure for several languages. They also show how to receive the arguments into local variables in the procedure." />
<meta name="description" content="These examples show how the arguments of the CALL statement are passed to the procedure for several languages. They also show how to receive the arguments into local variables in the procedure." />
<meta name="DC.subject" content="examples, stored procedures, returning completion status, stored procedure" />
<meta name="keywords" content="examples, stored procedures, returning completion status, stored procedure" />
<meta name="DC.Relation" scheme="URI" content="rbafyinvokeproc.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyce.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyrexxe.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="rbafyexamplecall" />
<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>Examples of CALL statements</title>
</head>
<body id="rbafyexamplecall"><a name="rbafyexamplecall"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples of CALL statements</h1>
<div><p>These examples show how the arguments of the CALL statement are
passed to the procedure for several languages. They also show how to receive
the arguments into local variables in the procedure.</p>
<div class="section"><p>The first example shows the calling ILE C program that uses the
CREATE PROCEDURE definitions to call the P1 and P2 procedures. Procedure P1
is written in C and has 10 parameters. Procedure P2 is written
in PL/I and also has 10 parameters.</p>
</div>
<div class="section"><p>Assume two procedures are defined as follows:</p>
</div>
<div class="example"> <pre>EXEC SQL <strong>CREATE PROCEDURE</strong> P1 <strong>(INOUT </strong>PARM1 <strong>CHAR(</strong>10<strong>),</strong>
<strong>INOUT</strong> PARM2 <strong>INTEGER,</strong>
<strong>INOUT</strong> PARM3 <strong>SMALLINT,</strong>
<strong>INOUT</strong> PARM4 <strong>FLOAT(</strong>22<strong>),</strong>
<strong>INOUT</strong> PARM5 <strong>FLOAT(</strong>53<strong>),</strong>
<strong>INOUT</strong> PARM6 <strong>DECIMAL(</strong>10,5<strong>),</strong>
<strong>INOUT</strong> PARM7 <strong>VARCHAR(</strong>10<strong>),</strong>
<strong>INOUT</strong> PARM8 <strong>DATE,</strong>
<strong>INOUT</strong> PARM9 <strong>TIME,</strong>
<strong>INOUT</strong> PARM10 <strong>TIMESTAMP)</strong>
<strong>EXTERNAL NAME</strong> TEST12.CALLPROC2
<strong>LANGUAGE C GENERAL WITH NULLS</strong>
EXEC SQL <strong>CREATE PROCEDURE</strong> P2 <strong>(INOUT</strong> PARM1 <strong>CHAR(</strong>10<strong>),</strong>
<strong>INOUT</strong> PARM2 <strong>INTEGER,</strong>
<strong>INOUT</strong> PARM3 <strong>SMALLINT,</strong>
<strong>INOUT</strong> PARM4 <strong>FLOAT(</strong>22<strong>),</strong>
<strong>INOUT</strong> PARM5 <strong>FLOAT(</strong>53<strong>),</strong>
<strong>INOUT</strong> PARM6 <strong>DECIMAL(</strong>10,5<strong>),</strong>
<strong>INOUT</strong> PARM7 <strong>VARCHAR(</strong>10<strong>),</strong>
<strong>INOUT</strong> PARM8 <strong>DATE,</strong>
<strong>INOUT</strong> PARM9 <strong>TIME,</strong>
<strong>INOUT</strong> PARM10 <strong>TIMESTAMP)</strong>
<strong>EXTERNAL NAME </strong>TEST12.CALLPROC
<strong>LANGUAGE PLI GENERAL WITH NULLS</strong> </pre>
</div>
</div>
<div>
<ul class="ullinks">
<li class="ulchildlink"><strong><a href="rbafyce.htm">Example 1: ILE C and PL/I procedures called from ILE C applications</a></strong><br />
</li>
<li class="ulchildlink"><strong><a href="rbafyrexxe.htm">Example 2. REXX procedure called from a C application</a></strong><br />
</li>
</ul>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafyinvokeproc.htm" title="The SQL CALL statement calls a stored procedure.">Invoke a stored procedure</a></div>
</div>
</div>
</body>
</html>