gtpc2mgw | C/C++ Language Support User's Guide |
This function deletes a data store (DS).
Format
#include <c$to2.h>
long TO2_deleteDS (TO2_ENV_PTR env_ptr,
const char dsname[TO2_MAX_DSNAME]);
- env_ptr
- A pointer to the environment as returned by the TO2_createEnv
function.
- dsname
- A pointer to a character string, which represents the data store being
deleted. The character string must be 8 characters or less in length,
left-justified, and padded with blanks (X'40') on the right.
Normal Return
A positive value.
Error Return
A value of zero. Use the TO2_getErrorCode function to
determine the specific error code. For more information, see Error Handling.
Programming Considerations
- This function deletes the data store entry from the TPF system dictionary
and deletes all system collections in that data store. All resources
used by these collections are returned to the system and none of these
collections can be reclaimed.
- You do not have to call this function from the subsystem that
created the data store.
- Deleting a data store does not delete user collections. You must
delete all user collections before calling this function or the pool records
used by these collections will be lost until the next recoup is run.
- You cannot delete the TPFDB data store.
- A commit scope will be created for the TO2_deleteDS
request. If the request is successful, the scope will be
committed. If an error occurs while processing the
TO2_deleteDS request, the scope will be rolled back.
Examples
The following example deletes data store TESTX.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 */
char dsname[TO2_MAX_DSNAME]="TESTX.DS";
·
·
·
if (TO2_deleteDS(env_ptr, dsname) == TO2_ERROR)
{
printf("TO2_deleteDS failed!\n");
process_error(env_ptr);
}
else
{
printf("TO2_deleteDS successful!\n");
}
Related Information
See TPF Application Programming for more
information about commit scope. See TPF Database
Reference for more information about data stores.