gtpc2mdr | C/C++ Language Support User's Guide |
This function defines a property with a mode. This function cannot be used to change an existing property value.
Format
#include <c$to2.h> long TO2_definePropertyWithModeForPID (const TO2_PID_PTR pid_ptr, TO2_ENV_PTR env_ptr, const char name[], const enum TO2_PROPERTY_TYPE *type, const long *valueLength, const void *value, const enum TO2_PROPERTY_MODE *mode);
(-1)x(sign bit) x (significand) x (Base^Exponent)
where: Exponent=characteristic - Bias and the Bias=64 and the Base=16 in an System/370 environment.
Normal Return
The normal return is a positive value.
Error Return
An error return is indicated by a zero. When zero is returned, the TO2_getErrorCode function can be used to determine the specific error code. For more information, see Error Handling.
The following error codes are common for this function:
TO2_ERROR_DATA_LGH
TO2_ERROR_DELETED_PID
TO2_ERROR_ENV
TO2_ERROR_PARAMETER
TO2_ERROR_PID
TO2_ERROR_PROPERTY_MODE
TO2_ERROR_PROPERTY_TYPE
TO2_ERROR_ZERO_PID
Programming Considerations
A commit scope will be created for the TO2_definePropertyWithModeForPID request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_definePropertyWithModeForPID request, the scope will be rolled back.
Examples
The following example defines a property attribute with a mode for a TPFCS database collection.
#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 */ TO2_PID keyset; TO2_PROPERTY_TYPE propertyType = TO2_PROPERTY_CHAR; TO2_PROPERTY_MODE propertyMode = TO2_PROPERTY_NORMAL; char propertyName[32] = "X.Property.attribute "; char value = 'x'; long valueLength = sizeof(value);
·
·
·
if (TO2_definePropertyWithModeForPID(&keyset, env_ptr, propertyName, &propertyType, &valueLength, &value, &propertyMode) == TO2_ERROR) { printf("TO2_definePropertyWithModeForPID failed!\n"); process_error(env_ptr); } else printf("TO2_definePropertyWithModeForPID successful!\n");
Related Information