gtpc2mgrC/C++ Language Support User's Guide

TO2_createDSwithOptions-Create a Data Store with an Option List

This function creates a data store (DS) using a passed option list to modify the normal data store create process.

Format

#include <c$to2.h>
long TO2_createDSwithOptions (      TO2_ENV_PTR     env_ptr,
                              const char            dsname[TO2_MAX_DSNAME],
                              const TO2_OPTION_PTR  optionListPtr);

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

dsname
The pointer to a character string, which is the DS being created. The character string must be 8 characters or greater in length, left-justified, and padded with blanks (X'40') on the right.

optionListPtr
The pointer to a returned options list from a TO2_createOptionList call.

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.

Programming Considerations

A commit scope will be created for the TO2_createDSwithOptions request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_createDSwithOptions request, the scope will be rolled back.

Examples

The following example creates a data store with the specified name that does not contain an inventory collection and delays the actual deletion of collections.

#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         */
dsname[] = "TESTDS ";              /* name of DS to create               */
TO2_OPTION_PTR optionListPtr;

  ·
  ·
  ·
/* invoke TO2 to create option list */ optionListPtr=TO2_createOptionList(env_ptr, TO2_OPTION_LIST_DS, /* create options */ TO2_DS_NOINVENTORY, /* do not create a PID */ /* inventory collection */ TO2_DS_DELETE_DELAY, /* delay collection */ /* deletions */ TO2_OPTION_LIST_END); /* end of options */ if (optionListPtr == TO2_ERROR) process_error(env_ptr); if (TO2_createDSwithOptions(env_ptr, dsname, optionListPtr) == TO2_ERROR) { printf("TO2_createDSwithOptions failed!\n"); process_error(env_ptr); } else { printf("TO2_createDSwithOptions successful!\n"); }

Related Information