gtpc2mhpC/C++ Language Support User's Guide

TO2_getRecoupIndexForPID-Retrieve Associated Recoup Index Name

This function is used to retrieve the name of a recoup index.

Format

#include <c$to2.h>
long TO2_getRecoupIndexForPID (const TO2_PID_PTR  pid_ptr
                                     TO2_ENV_PTR  env_ptr,
                                     void        *indexName);

pid_ptr
The pointer to the persistent identifier (PID) of a collection.

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

indexName
The pointer to an 8-byte field that is used to return the index name. indexName contains the name on return.

Normal Return

The normal return is a positive value.

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 codes are common for this function:

TO2_ERROR_ENV

TO2_ERROR_PID

Programming Considerations

This function does not use TPF transaction services on behalf of the caller.

Examples

The following example retrieves the key to an index.

#include <c$to2.h>                  /* Needed for TO2 API Functions    */
#include <stdio.h>                  /* APIs for standard I/O functions */
 
TO2_PID          collect;           /* target object's PID             */
TO2_ENV_PTR      env_ptr;           /* Pointer to TO2 environment      */
TO2_BUF_PTR      buf_ptr;           /* Pointer to a buffer area        */
 
char            *indexName;         /* index name                      */
 

  ·
  ·
  ·
memcpy(collect, buf_ptr->data, 32); if (TO2_getRecoupIndexForPID(&collect, env_ptr, indexName) == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); printf ("TO2_getRecoupIndexForPID failed!\n"); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("Recoup index name = %8s\n", indexName);

Related Information