gtpc2mh4C/C++ Language Support User's Guide

TO2_getCollectionName-Get the Class Name of a Collection

This function returns the class name of the specified collection.

Format

#include <c$to2.h>
TO2_BUF_PTR TO2_getCollectionName (const TO2_PID_PTR  pid_ptr,
                                         TO2_ENV_PTR  env_ptr);

pid_ptr
The pointer to the persistent identifier (PID) of the collection whose class name is to be retrieved.

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

Normal Return

The normal return is a pointer (TO2_BUF_PTR) to a structure (buffer) of type TO2_BUF_HDR (see Type Definitions).

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.

Programming Considerations

Examples

The following example retrieves the class name for the collection indicated.

#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_BUF_PTR  bufferPtr;
char         *collectionName;
long         nameLength;

  ·
  ·
  ·
if ((bufferPtr = TO2_getCollectionName(&collect, env_ptr)) == TO2_ERROR) { printf("TO2_getCollectionName failed!\n"); process_error(env_ptr); } else { collectionName = bufferPtr->data; nameLength = bufferPtr->dataL; printf("TO2_getCollectionName successful!\n"); }
  ·
  ·
  ·
free(buffer_ptr);

Related Information

TO2_getClassNames-Convert EBCDIC Class Name to Index.