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

80 lines
4.9 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="Use CALL statement where procedure definition exists" />
<meta name="abstract" content="This type of CALL statement reads all the information about the procedure and the argument attributes from the CREATE PROCEDURE catalog definition." />
<meta name="description" content="This type of CALL statement reads all the information about the procedure and the argument attributes from the CREATE PROCEDURE catalog definition." />
<meta name="DC.subject" content="stored procedures, invoking using CALL, CALL statement, stored procedure, statements, CALL, examples, embedded CALL, invoking stored procedures, where a CREATE PROCEDURE exists" />
<meta name="keywords" content="stored procedures, invoking using CALL, CALL statement, stored procedure, statements, CALL, examples, embedded CALL, invoking stored procedures, where a CREATE PROCEDURE exists" />
<meta name="DC.Relation" scheme="URI" content="rbafyinvokeproc.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="rbafyusingcall" />
<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>Use CALL statement where procedure definition exists</title>
</head>
<body id="rbafyusingcall"><a name="rbafyusingcall"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Use CALL statement where procedure definition exists</h1>
<div><p>This type of CALL statement reads all the information about the
procedure and the argument attributes from the CREATE PROCEDURE catalog definition.</p>
<div class="section"><p>The following PL/I example shows a CALL statement that corresponds
to the CREATE PROCEDURE statement shown.</p>
<pre>DCL HV1 <strong>CHAR</strong>(10);
DCL IND1 FIXED BIN(15);
:
EXEC SQL <strong>CREATE</strong> P1 <strong>PROCEDURE</strong>
(<strong>INOUT</strong> PARM1 <strong>CHAR</strong>(10))
<strong>EXTERNAL NAME</strong> MYLIB.PROC1
<strong>LANGUAGE</strong> C
<strong>GENERAL WITH NULLS</strong>;
:
EXEC SQL <strong>CALL</strong> P1 (:HV1 :IND1);
:</pre>
</div>
<div class="section"><p>When this CALL statement is issued, a call to program MYLIB/PROC1
is made and two arguments are passed. Since the language of the program is
ILE C, the first argument is a C NUL-terminated string eleven characters long
containing the contents of host variable HV1. Note that on a call to an ILE
C procedure, DB2<sup>®</sup> SQL
for <span class="keyword">iSeries™</span> adds one character
to the parameter declaration if the parameter is declared to be a character,
graphic, date, time, or timestamp variable. The second argument is the indicator
array. In this case, it is one short integer since there is only one parameter
in the CREATE PROCEDURE statement. This argument contains the contents of
indicator variable IND1 on entry to the procedure.</p>
</div>
<div class="section"><p>Since the first parameter is declared as INOUT, SQL updates the
host variable HV1 and the indicator variable IND1 with the values returned
from MYLIB.PROC1 before returning to the user program.</p>
</div>
<div class="section"><div class="note"><span class="notetitle">Notes:</span> <ol><li>The procedure names specified on the CREATE PROCEDURE and CALL statements
must match EXACTLY in order for the link between the two to be made during
the SQL precompile of the program.</li>
<li>For an embedded CALL statement where both a CREATE PROCEDURE and a DECLARE
PROCEDURE statement exist, the DECLARE PROCEDURE statement will be used.</li>
</ol>
</div>
</div>
</div>
<div>
<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>