gtpc2mgl | C/C++ Language Support User's Guide |
This function changes a data definition (DD).
Format
#include <c$to2.h> long TO2_changeDD ( TO2_ENV_PTR env_ptr, const char DDname[TO2_MAX_DDNAME], const char dsname[TO2_MAX_DSNAME], const TO2_OPTION_PTR optionListPtr);
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:
TO2_ERROR_DD_NOT_FOUND
TO2_ERROR_LOCATOR_NOT_FOUND
Programming Considerations
A commit scope will be created for the TO2_changeDD request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_changeDD request, the scope will be rolled back.
Examples
The following updates the data definition name (DDname) with the string passed in dsname.
#include <c$to2.h> /* Needed for TO2 API functions */ #include <stdio.h> /* APIs for standard I/O functions */ #define UNDEF -1 /* Error return indication */ long err_code; char DDname[32]; char dsname[8]; TO2_OPTION_PTR optionListPtr TO2_ENV_PTR env_ptr; /* Pointer to TO2 environment */
·
·
·
TO2_changeDD(env_ptr, DDname, dsname, optionListPtr); if (err_code == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); if (err_code == TO2_ERROR_DD_NOT_FOUND) return UNDEF; { printf("TO2_changeDD failed!\n"); process_error(env_ptr); } else { printf("TO2_changeDD successful!\n"); } }
Related Information