ibm-information-center/dist/eclipse/plugins/i5OS.ic.apiref_5.4.0.1/errorexceptions.htm

143 lines
7.0 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="Examples: Receiving error conditions" />
<meta name="abstract" content="These examples illustrate receiving error conditions" />
<meta name="description" content="These examples illustrate receiving error conditions" />
<meta name="DC.Relation" scheme="URI" content="error.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="errorexceptions" />
<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: Receiving error conditions</title>
</head>
<body id="errorexceptions"><a name="errorexceptions"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Examples: Receiving error conditions</h1>
<div><p>These examples illustrate receiving error conditions</p>
<div class="section"><h4 class="sectiontitle">Example: Receiving error conditions as exceptions</h4><p>This
example shows an application that receives error conditions as exceptions.
It allocates an error code parameter that is a minimum of 4 bytes long to
hold the bytes provided field. The only field used is the bytes-provided INPUT
field, which the application sets to zero to request exceptions. The error
code parameter contains the following:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e24">Field</th>
<th valign="top" id="d0e26">INPUT</th>
<th valign="top" id="d0e28">OUTPUT</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e24 ">Bytes provided</td>
<td valign="top" headers="d0e26 ">0</td>
<td valign="top" headers="d0e28 ">0</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Example: Receiving the error code without the exception data</h4><p>This
application example attempts to create an alert for message ID USR1234 in
message file USRMSG in library QGPL. It receives the error condition in the
error code parameter but does not receive any exception data. To do this,
it allocates an error code parameter that is a minimum of 16 bytes long--for
the bytes provided, bytes available, exception ID, and reserved fields. It
sets the bytes-provided field of the error code parameter to 16.</p>
<p>When
the application calls the Generate Alert (QALGENA) API, the alert table USRMSG
is not found, and QALGENA returns exception CPF7B03. The error code parameter
contains the data shown in the following table. In this example, 16 bytes
are provided for data, but 36 are available. Twenty more bytes of data could
be returned if the bytes-provided field were set to reflect a larger error
code parameter.</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e52">Field</th>
<th valign="top" id="d0e54">INPUT</th>
<th valign="top" id="d0e56">OUTPUT</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e52 ">Bytes provided</td>
<td valign="top" headers="d0e54 ">16</td>
<td valign="top" headers="d0e56 ">16</td>
</tr>
<tr><td valign="top" headers="d0e52 ">Bytes available</td>
<td valign="top" headers="d0e54 ">Ignored</td>
<td valign="top" headers="d0e56 ">36</td>
</tr>
<tr><td valign="top" headers="d0e52 ">Exception ID</td>
<td valign="top" headers="d0e54 ">Ignored</td>
<td valign="top" headers="d0e56 ">CPF7B03</td>
</tr>
<tr><td valign="top" headers="d0e52 ">Reserved</td>
<td valign="top" headers="d0e54 ">Ignored</td>
<td valign="top" headers="d0e56 ">0</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section"><h4 class="sectiontitle">Example: Receiving the error code with the exception data</h4><p>This
application example attempts to create an alert for message ID USR1234 in
message file USRMSG in library QGPL. It receives the error condition in the
error code parameter and receives exception data as well. To do this, it allocates
an error code parameter that is 116 bytes long--16 bytes for the bytes provided,
bytes available, exception ID, and reserved fields, and 100 bytes for the
exception data for the exception. (In some cases, the exception data might
be a variable-length directory or file name, so this might not be large enough
to hold all of the data; whatever fits is returned in the error code parameter.)
Finally, it sets the bytes-provided field to 116.</p>
<p>When the application
calls the Generate Alert (QALGENA) API, the alert table USRMSG is not found,
and QALGENA returns exception CPF7B03. The error code parameter contains the
following:</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" id="d0e101">Field</th>
<th valign="top" id="d0e103">INPUT</th>
<th valign="top" id="d0e105">OUTPUT</th>
</tr>
</thead>
<tbody><tr><td valign="top" headers="d0e101 ">Bytes provided</td>
<td valign="top" headers="d0e103 ">116</td>
<td valign="top" headers="d0e105 ">116</td>
</tr>
<tr><td valign="top" headers="d0e101 ">Bytes available</td>
<td valign="top" headers="d0e103 ">Ignored</td>
<td valign="top" headers="d0e105 ">36</td>
</tr>
<tr><td valign="top" headers="d0e101 ">Exception ID</td>
<td valign="top" headers="d0e103 ">Ignored</td>
<td valign="top" headers="d0e105 ">CPF7B03</td>
</tr>
<tr><td valign="top" headers="d0e101 ">Reserved</td>
<td valign="top" headers="d0e103 ">Ignored</td>
<td valign="top" headers="d0e105 ">0</td>
</tr>
<tr><td valign="top" headers="d0e101 ">Exception data</td>
<td valign="top" headers="d0e103 ">Ignored</td>
<td valign="top" headers="d0e105 "> USRMSG QGPL</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="error.htm" title="An API error code parameter is a variable-length structure that is common to all of the system APIs.">Error code parameter</a></div>
</div>
</div>
</body>
</html>