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

108 lines
7.6 KiB
HTML
Raw Permalink 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 file reference variables" />
<meta name="abstract" content="File reference variables are similar to host variables except that they are used to transfer data to and from IFS files (not to and from memory buffers)." />
<meta name="description" content="File reference variables are similar to host variables except that they are used to transfer data to and from IFS files (not to and from memory buffers)." />
<meta name="DC.subject" content="LOBs (Large Objects), file reference variables, input values, file reference variables, SQL_FILE_READ, input value option, LOBs (Large Objects), output values, SQL_FILE_CREATE, output value option, SQL_FILE_OVERWRITE, output value option, SQL_FILE_APPEND, output value option" />
<meta name="keywords" content="LOBs (Large Objects), file reference variables, input values, file reference variables, SQL_FILE_READ, input value option, LOBs (Large Objects), output values, SQL_FILE_CREATE, output value option, SQL_FILE_OVERWRITE, output value option, SQL_FILE_APPEND, output value option" />
<meta name="DC.Relation" scheme="URI" content="rbafylobs.htm" />
<meta name="DC.Relation" scheme="URI" content="rbafyloblocators.htm" />
<meta name="DC.Relation" scheme="URI" content="../ifs/rzaaxkickoff.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="rbafylobrefvar" />
<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 file reference variables</title>
</head>
<body id="rbafylobrefvar"><a name="rbafylobrefvar"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">LOB file reference variables</h1>
<div><p>File reference variables are similar to host variables except that
they are used to transfer data to and from IFS files (not to and from memory
buffers).</p>
<div class="section"><p>A file reference variable represents (rather than contains) the
file, just as a LOB locator represents (rather than contains) the LOB value.
Database queries, updates, and inserts may use file reference variables to
store, or to retrieve, single LOB values.</p>
</div>
<div class="section"><p>For very large objects, files are natural containers. It is likely
that most LOBs begin as data stored in files on the client before they are
moved to the database on the server. The use of file reference variables assists
in moving LOB data. Programs use file reference variables to transfer LOB
data from the IFS file directly to the database engine. To carry out the
movement of LOB data, the application does not need to write utility routines
to read and write files using host variables.</p>
</div>
<div class="section"> <div class="note"><span class="notetitle">Note:</span> The file referenced by the file reference variable must be
accessible from (but not necessarily resident on) the system on which the
program runs. For a stored procedure, this is the server.</div>
</div>
<div class="section"><p>A file reference variable has a data type of BLOB, CLOB, or DBCLOB.
It is used either as the source of data (input) or as the target of data
(output). The file reference variable may have a relative file name or a
complete path name of the file (the latter is advised). The file name length
is specified within the application program. The data length portion of the
file reference variable is unused during input. During output, the data length
is set by the application requester code to the length of the new data that
is written to the file.</p>
</div>
<div class="section"><p>When using file reference variables there are different options
on both input and output. You must choose an action for the file by setting
the <samp class="codeph">file_options</samp> field in the file reference variable structure.
Choices for assignment to the field covering both input and output values
are shown below.</p>
</div>
<div class="section"><p>Values (shown for C) and options when using input file reference
variables are as follows:</p>
<ul><li><strong>SQL_FILE_READ</strong> (Regular file) — This option has a value of 2. This
is a file that can be open, read, and closed. DB2<sup>®</sup> determines the length of the data in
the file (in bytes) when opening the file. DB2 then returns the length through the <samp class="codeph">data_length</samp>
field of the file reference variable structure. The value for COBOL is SQL-FILE-READ.</li>
</ul>
</div>
<div class="section"><p>Values and options when using output file reference variables
are as follows:</p>
<ul><li><strong>SQL_FILE_CREATE</strong> (New file) — This option has a value of 8. This
option creates a new file. Should the file already exist, an error message
is returned. The value for COBOL is SQL-FILE-CREATE. </li>
<li><strong>SQL_FILE_OVERWRITE</strong> (Overwrite file) — This option has a value
of 16. This option creates a new file if none already exists. If the file
already exists, the new data overwrites the data in the file. The value for
COBOL is SQL-FILE-OVERWRITE.</li>
<li><strong>SQL_FILE_APPEND</strong> (Append file) — This option has a value of 32.
This option has the output appended to the file, if it exists. Otherwise,
it creates a new file. The value for COBOL is SQL-FILE-APPEND.</li>
</ul>
<div class="note"><span class="notetitle">Note:</span> If a LOB file reference variable is used in an OPEN statement,
do not delete the file associated with the LOB file reference variable until
the cursor is closed.</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rbafylobs.htm" title="The VARCHAR, VARGRAPHIC, and VARBINARY data types have a limit of 32 KB (where KB equals 1024 bytes) of storage. While this may be sufficient for small to medium-size text data, applications often need to store large text documents. They might also need to store a wide variety of additional data types such as audio, video, drawings, mixed text and graphics, and images. There are three data types to store these data objects as strings of up to 2 GB (where GB equals 1 073 741 824 bytes).">Use large objects (LOBs)</a></div>
</div>
<div class="relconcepts"><strong>Related concepts</strong><br />
<div><a href="rbafyloblocators.htm" title="Large object (LOB) locators use a small, easily managed value to refer to a much larger value.">Understand large object locators</a></div>
</div>
<div class="relinfo"><strong>Related information</strong><br />
<div><a href="../ifs/rzaaxkickoff.htm">Integrated file system</a></div>
</div>
</div>
</body>
</html>