ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/qxdaxarecover.htm

347 lines
9.4 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Recover XA (QxdaXARecover) API</title>
<!-- Begin Header Records ========================================= -->
<!-- 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. -->
<!-- 0300508 JETAYLOR html cleanup -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="top_Of_Page"></a>
<!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<h2>Recover XA (QxdaXARecover) API</h2>
<div class="box" style="width: 80%;">
<br>
&nbsp;&nbsp;Required Parameter Group:<br>
<!-- iddvc RMBR -->
<br>
<table width="100%">
<tr>
<td align="center" valign="top" width="10%">1</td>
<td align="left" valign="top" width="50%">Connection handle</td>
<td align="left" valign="top" width="20%">Input</td>
<td align="left" valign="top" width="20%">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">2</td>
<td align="left" valign="top">Array of transaction branch identifiers</td>
<td align="left" valign="top">Output</td>
<td align="left" valign="top">Array of Char(140)</td>
</tr>
<tr>
<td align="center" valign="top">3</td>
<td align="left" valign="top">Array entries allocated</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">4</td>
<td align="left" valign="top">Return value</td>
<td align="left" valign="top">Output</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">5</td>
<td align="left" valign="top">Flags</td>
<td align="left" valign="top">Input</td>
<td align="left" valign="top">Binary(4)</td>
</tr>
<tr>
<td align="center" valign="top">6</td>
<td align="left" valign="top">Error code</td>
<td align="left" valign="top">I/O</td>
<td align="left" valign="top">Void(*)</td>
</tr>
</table>
<br>
&nbsp;&nbsp;Service Program: QXDAEDRS<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Conditional; see <a href="#usage_notes">Usage
Notes</a><br>
<!-- iddvc RMBR -->
<br>
</div>
<p>A transaction manager calls QxdaXARecover() during recovery to obtain a list
of transaction branch identifiers that are currently in a prepared or
heuristically completed state. Multiple calls to this function can be made in a
single recovery scan. The flags parameter defines when a recovery scan should
start or end. The connection does not have to be associated with the
transaction in any way.</p>
<br>
<h3>Authorities and Locks</h3>
<p>None.</p>
<br>
<h3>Required Parameter Group</h3>
<dl>
<dt><strong>Connection handle</strong></dt>
<dd>INPUT; BINARY(4)
<p>The handle number of the connection on which to perform the XA operation.
The connection handle must have been generated by the QxdaConnectEDRS API in
the current job and activation group.</p>
</dd>
<dt><strong>Array of transaction branch identifiers</strong></dt>
<dd>OUTPUT; CHAR(*)
<p>An array into which the resource manager places XIDs, each containing a max
size of 140 bytes, for transaction branches in prepared or heuristically
completed states.</p>
</dd>
<dt><strong>Array entries allocated</strong></dt>
<dd>INPUT; BINARY(4)
<p>The number of transaction branch identifiers that can be returned into the
Array of transaction branch identifiers.</p>
</dd>
<dt><strong>Return value</strong></dt>
<dd>OUTPUT; BINARY(4)
<p>The return value of the XA operation. Possible return values:</p>
<table cellpadding="5">
<!-- cols="10 25 65" -->
<tr>
<td align="left" valign="top"><em>-6</em></td>
<td align="left" valign="top">[XAER_PROTO]</td>
<td align="left" valign="top"><strong>xa_recover()</strong> was not successful.
Function was called in an improper context.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-5</em></td>
<td align="left" valign="top">[XAER_INVAL]</td>
<td align="left" valign="top"><strong>xa_recover()</strong> was not successful.
Incorrect arguments were specified.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-3</em></td>
<td align="left" valign="top">[XAER_RMERR]</td>
<td align="left" valign="top"><strong>xa_recover()</strong> was not successful.
The resource manager detected an error when retrieving the transaction
branch.</td>
</tr>
</table>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em> &gt;=0</em></td>
<td align="left" valign="top">The total number of XIDs returned in the xids
array.</td>
</tr>
</table>
<br>
</dd>
<dt><strong>Flags</strong></dt>
<dd>INPUT; BINARY(4)
<p> Indicator of how to perform the XA operation. The following are valid
settings of flags:</p>
<table cellpadding="5">
<!-- cols="20 15 65" -->
<tr>
<td align="left" valign="top"><em>TMSTARTRSCAN:</em></td>
<td align="left" valign="top">x01000000</td>
<td align="left" valign="top">Start a recovery scan and position the cursor to
the start of the list. Transaction Branch Identifiers are returned from that
point.</td>
</tr>
<tr>
<td align="left" valign="top"><em>TMENDRSCAN:</em></td>
<td align="left" valign="top">x00800000</td>
<td align="left" valign="top">End a recovery scan after returning the XIDs. If
this flag is used with the <em>TMSTARTRSCAN</em> flag, then a single
xa_recover() call starts and ends the recovery scan.</td>
</tr>
<tr>
<td align="left" valign="top"><em>TMNOFLAGS:</em></td>
<td align="left" valign="top">x00000000</td>
<td align="left" valign="top">Continue a recovery scan. Transaction Branch
Identifiers are returned starting at the current cursor position.</td>
</tr>
</table>
<br>
</dd>
<dt><strong>Error code</strong></dt>
<dd>I/O; CHAR(*)
<p>The structure in which to return error information. For the format of the
structure, see <a href="../apiref/error.htm#hdrerrcod">Error Code Parameter</a>.</p>
</dd>
</dl>
<br>
<br>
<h3><a name="usage_notes">Usage Notes</a></h3>
<p>This function may be called from the initial thread of a job only.</p>
<br>
<h3>Error Messages</h3>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td align="left" valign="top">CPE3418 E</td>
<td align="left" valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td align="left" valign="top">CPF3CF2 E</td>
<td align="left" valign="top">Error(s) occurred during running of &amp;1
API.</td>
</tr>
<tr>
<td align="left" valign="top">CPF9872 E</td>
<td align="left" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
<tr>
<td align="left" valign="top">CPFB760 E</td>
<td align="left" valign="top">Error encountered in &amp;2 API, return code
&amp;1.</td>
</tr>
</table>
<br>
<h3>Related Information</h3>
<p>The QxdaXA APIs follow the NTS (transactions with transaction scoped locks)
model. For more information regarding the NTS model, see <a href="unix12.htm">
XA APIs</a>.<br>
</p>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<pre>
#include qxdaedrs.h
main()
{
err_t err;
Qxda_CDBI0100_t *istr = (Qxda_CDBI0100_t *)instruct;
Qxda_CDBO0100_t ostr;
int ostrsize;
<strong>XID xids[10];</strong>
Qsq_sqlca_t myca;
int stmt1len = 21;
<strong>int flags = TMSTARTRSCAN + TMENDRSCAN;</strong>
int count = 30;
int ret_val;
memset(istr, '\0', sizeof(Qxda_CDBI0100_t));
istr-&gt;Connection_Type = 'U';
memset(istr-&gt;Server_Name, ' ', 256);
istr-&gt;Commitment_Control = 'S';
_CPYBYTES(istr-&gt;Commit_Scope, "*XA ", 10);
istr-&gt;Allow_Suspend = 'Y';
memset(istr-&gt;RDB_Specified, '0', 1);
istr-&gt;SQLDA_Cache_Size = 10;
istr-&gt;Offset_Job_Data = sizeof(Qxda_CDBI0100_t);
istr-&gt;Length_Job_Data = 7;
_CPYBYTES((char *)istr + istr-&gt;Offset_Job_Data, "CONNECT", 7);
istr-&gt;Offset_Suspend_Data = istr-&gt;Offset_Job_Data + istr-&gt;Length_Job_Data;
istr-&gt;Length_Suspend_Data = 7;
memset(istr-&gt;RDB_Name, ' ', 18);
<strong> _CPYBYTES(istr-&gt;TM_Info, "TM_Name ", 10);</strong>
<strong>istr-&gt;LockTimeoutVal = 10; </strong>
ostrsize = sizeof(Qxda_CDBO0100_t);
QxdaConnectEDRS(istr, "CDBI0100", &amp;ostr, &amp;ostrsize,
"CDBO0100", &amp;err);
<strong> QxdaXARecover(&amp;ostr.Connection_Handle, xids, &amp;count, &amp;ret_val, &amp;flags, &amp;err);</strong>
}
</pre>
<br>
<hr>
API introduced: V5R3
<hr>
<table align="center" cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#top_Of_Page">Top</a> | <a href=
"file1.htm">Database and File APIs</a> | <a href="aplist.htm">APIs by
category</a></td>
</tr>
</table>
</body>
</html>