gtpc2mhxC/C++ Language Support User's Guide

TO2_recoupCollection-Return Head of Chain File Addresses

This function returns a sequence collection containing the head of chain file address for the collection specified for use by recoup.

Format

#include <c$to2.h>
long  TO2_recoupCollection (const TO2_PID_PTR   pid_ptr,
                                  TO2_ENV_PTR   env_ptr,
                                  TO2_PID_PTR   rpid_ptr);

pid_ptr
The pointer to the persistent identifier (PID) of the collection that will be recouped.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

rpid_ptr
The pointer to the field to hold the temporary PID of the returned sequence collection.

Normal Return

The sequence collection contains one 8-byte element per pool file chain for the target collection. The format of this element (representing the head of the file chain) is as follows:

struct  chainElement
{
  u_char    recordID[2];
  u_char    reserved[2];
  u_char    file_Address[8];
}

Error Return

An error return is indicated by a zero. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error code is common for this function:

TO2_ERROR_RECOUP_ABORT

Programming Considerations

When the caller is done with the returned collection, delete the collection by using the TO2_deleteCollection function.

Examples

The following example recoups the specified collection.

#include <c$to2.h>             /* Needed for TO2 API functions     */
#include <stdio.h>             /* APIs for standard I/O functions  */
 
TO2_ENV_PTR  env_ptr;          /* Pointer to TO2 environment       */
TO2_PID      collect,
TO2_PID      returnPidPtr;

  ·
  ·
  ·
if (TO2_recoupCollection(&collect, env_ptr, &returnPidPtr) == TO2_ERROR) { printf("TO2_recoupCollection failed!\n"); process_error(env_ptr); } else { printf("TO2_recoupCollection successful!\n"); }

Related Information