gtpc2mgbC/C++ Language Support User's Guide

TO2_getDSdictPID-Get the Dictionary PID of a Data Store

This function returns the persistent identifier (PID) of the symbolic dictionary for the data store (DS) specified in the passed environment to the specified field.

Format

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

pid_ptr
The pointer to a field where the dictionary PID of the data store will be returned.

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

Normal Return

The normal return is a positive value and the specified TO2_PID_PTR field will contain the PID of the data store dictionary.

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_NOT_INIT

Programming Considerations

None.

Examples

The following example copies the PID of the data store dictionary for data store TEST1_DS.

#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       dictionaryPID;             /* return area for PID             */
long          userTkn = 0;
char          ApplicationName[33]="ApplicationName1                ";
char          DSname[]="TEST1_DS";       /* data store name blank padded    */
TO2_ERR_CODE  to2_rc=1;                  /* return code receiver            */
TO2_ERR_TEXT_PTR err_textPtr;            /* TO2 error code text pointer     */

  ·
  ·
  ·
{ if ((to2_rc = TO2_createEnv(&env_ptr, &userTkn, ApplicationName, DSname)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_createEnv failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else { if ((to2_rc = TO2_getDSdictPID(&dictionaryPID, env_ptr)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_getDSdictPID failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("TO2 get data store's dictionary's PID successful\n"); } }

Related Information

TO2_getTPFDictPID-Get the PID of the TPF Dictionary.