ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzajp_5.4.0.1/rzajpcoblob.htm

151 lines
9.1 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="LOB host variables in COBOL applications that use SQL" />
<meta name="abstract" content="COBOL does not have variables that correspond to the SQL data types for LOBs (large objects). To create host variables that can be used with these data types, use the SQL TYPE IS clause. The SQL precompiler replaces this declaration with a COBOL language structure in the output source member." />
<meta name="description" content="COBOL does not have variables that correspond to the SQL data types for LOBs (large objects). To create host variables that can be used with these data types, use the SQL TYPE IS clause. The SQL precompiler replaces this declaration with a COBOL language structure in the output source member." />
<meta name="DC.subject" content="LOB host variable, COBOL, host variable, LOB, COBOL program, CLOB host variable, host variable, CLOB, DBCLOB host variable, DBCLOB, BLOB host variable, BLOB, LOB locator, locator, LOB file reference variable, file reference variable" />
<meta name="keywords" content="LOB host variable, COBOL, host variable, LOB, COBOL program, CLOB host variable, host variable, CLOB, DBCLOB host variable, DBCLOB, BLOB host variable, BLOB, LOB locator, locator, LOB file reference variable, file reference variable" />
<meta name="DC.Relation" scheme="URI" content="rzajpdeclaringhostcobol.htm" />
<meta name="DC.Relation" scheme="URI" content="../sqlp/rbafylobrefvar.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="rzajpcoblob" />
<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>LOB host variables in COBOL applications that use SQL</title>
</head>
<body id="rzajpcoblob"><a name="rzajpcoblob"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">LOB host variables in COBOL applications that use SQL</h1>
<div><p>COBOL does not have variables that correspond to the SQL data types
for LOBs (large objects). To create host variables that can be used with these
data types, use the SQL TYPE IS clause. The SQL precompiler replaces this
declaration with a COBOL language structure in the output source member.</p>
<div class="section"><p>LOB host variables are only supported in ILE COBOL for <span class="keyword">iSeries™</span>.</p>
</div>
<div class="section"><h4 class="sectiontitle">LOB host variables</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcoblobsyn1.htm" /></span><a href="#d0e122"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-01--<i>variable-name</i>-------------------------------------------->
    .-IS-.    
   .-USAGE--+----+-.    
>--+---------------+--SQL TYPE IS--+-CLOB---+--(--<i>lob-length</i>--+---+--)-->
    +-DBCLOB-+ +-K-+    
    '-BLOB---' '-M-'    
>-- . --------------------------------------------------------->&lt;
</pre><a name="d0e122"></a></div>
<div class="section"> <div class="note"><span class="notetitle">Notes:</span> <ol><li>For BLOB and CLOB, 1 ≤ lob-length ≤ 15,728,640</li>
<li>For DBCLOB, 1 ≤ lob-length ≤ 7,864,320</li>
<li>SQL TYPE IS, BLOB, CLOB, DBCLOB can be in mixed case.</li>
</ol>
</div>
</div>
<div class="section"><h4 class="sectiontitle"><em>CLOB Example</em></h4><p>The following declaration:</p>
<pre>01 MY-CLOB SQL TYPE IS CLOB(16384).</pre>
<p>Results
in the generation of the following structure:</p>
<pre>01 MY-CLOB.
49 MY-CLOB-LENGTH PIC 9(9) BINARY.
49 MY-CLOB-DATA PIC X(16384).</pre>
</div>
<div class="section"><h4 class="sectiontitle"><em>DBCLOB Example</em></h4><p>The following declaration: </p>
<pre>01 MY-DBCLOB SQL TYPE IS DBCLOB(8192).</pre>
<p>Results
in the generation of the following structure: </p>
<pre>01 MY-DBCLOB.
49 MY-DBCLOB-LENGTH PIC 9(9) BINARY.
49 MY-DBCLOB-DATA PIC G(8192) DISPLAY-1.</pre>
</div>
<div class="section"><h4 class="sectiontitle"><em>BLOB Example</em></h4><p>The following declaration: </p>
<pre>01 MY-BLOB SQL TYPE IS BLOB(16384).</pre>
<p>Results
in the generation of the following structure: </p>
<pre>01 MY-BLOB.
49 MY-BLOB-LENGTH PIC 9(9) BINARY.
49 MY-BLOB-DATA PIC X(16384).</pre>
</div>
<div class="section"><h4 class="sectiontitle">LOB Locator</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcoblobsyn2.htm" /></span><a href="#d0e210"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-01--<i>variable-name</i>-------------------------------------------->
    .-IS-.    
   .-USAGE--+----+-.    
>--+---------------+--SQL TYPE IS--+-CLOB-LOCATOR---+-- . ----->&lt;
    +-DBCLOB-LOCATOR-+    
    '-BLOB-LOCATOR---'    
</pre><a name="d0e210"></a></div>
<div class="section"> <div class="note"><span class="notetitle">Notes:</span> <ol><li>SQL TYPE IS, BLOB-LOCATOR, CLOB-LOCATOR, DBCLOB-LOCATOR can be in mixed
case.</li>
<li>LOB Locators cannot be initialized in the SQL TYPE IS statement.</li>
</ol>
</div>
</div>
<div class="section"><p>CLOB and DBCLOB locators have similar syntax.</p>
</div>
<div class="section"><h4 class="sectiontitle"><em>BLOB Locator Example</em></h4><p>The following declaration: </p>
<pre>01 MY-LOCATOR SQL TYPE IS BLOB_LOCATOR.</pre>
<p>Results in the following generation:</p>
<pre>01 MY-LOCATOR PIC 9(9) BINARY.</pre>
</div>
<div class="section"><h4 class="sectiontitle">LOB File Reference Variable</h4><pre><span><img src="./c.gif" border="0" alt="Read syntax diagram" longdesc="rzajpcoblobsyn3.htm" /></span><a href="#d0e263"><img src="./c.gif" border="0" alt="Skip visual syntax diagram" /></a>
>>-01--<i>variable-name</i>-------------------------------------------->
    .-IS-.    
   .-USAGE--+----+-.    
>--+---------------+--SQL TYPE IS--+-CLOB-FILE---+-- . -------->&lt;
    +-DBCLOB-FILE-+    
    '-BLOB-FILE---'    
</pre><a name="d0e263"></a></div>
<div class="section"> <div class="note"><span class="notetitle">Note:</span> SQL TYPE IS, BLOB-FILE, CLOB-FILE, DBCLOB-FILE can be in mixed
case.</div>
</div>
<div class="section"><h4 class="sectiontitle"><em>BLOB File Reference Example</em></h4><p>The following
declaration: </p>
<pre>01 MY-FILE SQL TYPE IS BLOB-FILE.</pre>
<p>Results
in the generation of the following structure: </p>
<pre>01 MY-FILE.
49 MY-FILE-NAME-LENGTH PIC S9(9) COMP-5.
49 MY-FILE-DATA-LENGTH PIC S9(9) COMP-5.
49 MY-FILE-FILE-OPTIONS PIC S9(9) COMP-5.
49 MY-FILE-NAME PIC X(255).</pre>
</div>
<div class="section"><p>CLOB and DBCLOB file reference variables have similar syntax.</p>
</div>
<div class="section"><p>The pre-compiler will generate declarations for the following
file option constants. You can use these constants to set the xxx-FILE-OPTIONS
variable when you use File Reference host variables. </p>
<ul><li>SQL_FILE_READ (2)</li>
<li>SQL_FILE_CREATE (8)</li>
<li>SQL_FILE_OVERWRITE (16)</li>
<li>SQL_FILE_APPEND (32)</li>
</ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzajpdeclaringhostcobol.htm" title="The COBOL precompiler only recognizes a subset of valid COBOL declarations as valid host variable declarations.">Declare host variables in COBOL applications that use SQL</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../sqlp/rbafylobrefvar.htm">LOB file reference variables</a></div>
</div>
</div>
</body>
</html>