gtpc2mhr | C/C++ Language Support User's Guide |
This function tests the specified data store (DS) for the given data definition (DD) name.
Format
#include <c$to2.h> long TO2_isDDdefined ( TO2_ENV_PTR env_ptr, const char *ddname, const char *dsname);
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.
The following error codes are common for this function:
Programming Considerations
None.
Examples
The following example tests the specified data definition name to determine if it has already been created.
#include <c$to2.h> /* Needed for TO2 API functions */ #include <stdio.h> /* APIs for standard I/O functions */ { long err_code=0; TO2_ENV_PTR env_ptr=0; /* Pointer to TO2 environment */ char ddname[]="TEST1_DDNAME_FOR_TEST1_DS "; char dsname[]="TEST1_DS";
·
·
·
if (TO2_isDDdefined(env_ptr, DDname, dsname) == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); if (err_code == 0) printf("%s does not exist\n",ddname); else process_error(env_ptr); } else printf("%s already exists\n",ddname); }
Related Information