gtpc2mgmC/C++ Language Support User's Guide

TO2_changeDS-Change the Attributes of a Data Store

This function changes data store (DS) attributes using a passed option list.

Format

#include <c$to2.h>
long TO2_changeDS (      TO2_ENV_PTR     env_ptr,
                   const char            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 name of the DS being changed. 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 option list from a TO2_createOptionList call.
Note:
The TO2_DS... options are used with the DS option list (TO2_OPTION_LIST_DS).

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_changeDS request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_changeDS request, the scope will be rolled back.

Examples

The following example creates an inventory collection if one does not exist. This example also changes a specified data store to use immediate deletes.

#include <c$to2.h>                   /* Needed for TO2 API functions     */
#include <stdio.h>                   /* APIs for standard I/O functions  */
 
long           err_code;
TO2_ENV_PTR    env_ptr;              /* Pointer to TO2 environment       */
char      dsname[]="TESTDS1 ";       /* data store to change             */
TO2_OPTION_PTR optionListPtr;
 
                                     /* invoke TO2 to create option list */

  ·
  ·
  ·
optionListPtr=TO2_createOptionList(env_ptr, TO2_OPTION_LIST_DS, /* create options */ TO2_DS_INVENTORY, /* create a PID */ /* inventory collection */ TO2_DS_DELETE_IMMED, /* process collection */ /* deletions immediately*/ TO2_OPTION_LIST_END); /* end of options */ if (optionListPtr == TO2_ERROR) process_error(env_ptr); if (TO2_changeDS(env_ptr, dsname, optionListPtr) == TO2_ERROR) { printf("TO2_changeDS failed!\n"); process_error(env_ptr); } else { printf("TO2_changeDS successful!\n"); }

Related Information