gtpc2mhoC/C++ Language Support User's Guide

TO2_getRecoupIndex-Get an Index

This function is used to get the TPF collection support (TPFCS) recoup index that a persistent identifier (PID) is associated with.

Format

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

pid_ptr
The pointer to the PID of the recoup index. This is a return value.

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

indexName
The pointer to an 8-byte field where the index name is to be returned.

Normal Return

The normal return is a sequence collection. When there is a normal return, it contains a copy of the data requested in a TO2_RCPIDX structure and is formatted as follows:

TEMPL_HDR
The template header.

TEMPL_NAME
The recoup index name.

TEMPL_PID
The PID of the index collection.

TEMPL_TYPE
TO2_RECOUP_TYPE:

TO2_RECOUP_HOMOGENEOUS
A homogeneous collection.

TO2_RECOUP_HETEROGENEOUS
A heterogeneous collection.

TEMPL_CNTRL
TO2_RECOUP_CONTROL:

TO2_RECOUP_CONTROL_RESTRICT
General entry control blocks (ECBs) for all associated PIDs.

TO2_RECOUP_CONTROL_USER
User exit for the anchor PID.

TEMPL_SPARE
Spare bytes.

TEMPL_PNAME
User exit program name.

TEMPL_FNAME
User exit function name.

TEMPL_TEXT
Descriptor text.

When there is a normal return, it contains a copy of the elements of the collection whose PID is returned in a TO2_RCPIDX_ENTRY structure and is formatted as follows:

TEMPL_ENTRY
The header file.

TEMPL_E_TOK
The token value of the entry.

TEMPL_E_TYPE
TO2_RECOUP_ENTRY_TYPE:

TO2_RECOUP_ENTRY_PID
The PID.

TO2_RECOUP_ENTRY_FA
The file address.

TEMPL_E_ACC
TO2_RECOUP_ENTRY_ACCESS:

TO2_RECOUP_ACCESS_KEY
The access key.

TO2_RECOUP_ACCESS_INDEX
The access index.

TEMPL_E_RSRV
Is reserved.

TEMPL_E_DSP
Is the displacement.

TEMPL_E_IDX
Is the index.

TEMPL_E_LEN
Is the key length.

TEMPL_E_KEY
Is the key.

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_ENV

Programming Considerations

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

Examples

The following example adds an entry to an index.

#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;           /*                                 */
void            *indexName;         /* index key                       */
 

  ·
  ·
  ·
if (TO2_getRecoupIndex(&collect, env_ptr, indexName) == TO2_ERROR) { process_error() err_code = TO2_getErrorCode(env_ptr); printf ("TO2_getRecoupIndex failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("Index name is %\n", indexName);

Related Information