gtpc2meiC/C++ Language Support User's Guide

TO2_removeRBA-Remove an Area from a BLOB

This function logically zeros the area of the binary large object (BLOB) starting at the specified relative byte address (RBA) for the specified length. The function causes no change in the size of the BLOB.

Note:
This function does not support all collections. See Table 47 for collections that are supported for this function.

Format

#include <c$to2.h>
long  TO2_removeRBA (const TO2_PID_PTR pid_ptr,
                           TO2_ENV_PTR env_ptr,
                     const long        *relativeByteToRemove,
                     const long        *lengthToRemove);

pid_ptr
The pointer to the persistent identifier (PID) assigned to the area in a BLOB that will be removed.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

relativeByteToRemove
The pointer to the start of the area that will be removed.

lengthToRemove
The pointer to the number of bytes that will be removed.

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_INVALID_INDEX

TO2_ERROR_INVALID_DATA_LGH

Programming Considerations

A commit scope will be created for the TO2_removeRBA request. If the request is successful, the scope will be committed. If an error occurs while processing the TO2_removeRBA request, the scope will be rolled back.

Examples

The following example zeros 20 bytes in the BLOB specified, starting at relative byte address 10.

#include <c$to2.h>          /* Needed for TO2 API functions         */
#include <stdio.h>          /* APIs for standard I/O functions      */
 
long test_error(void);
 
TO2_ENV_PTR    env_ptr;     /* PTR to the TO2 environment           */
TO2_PID_PTR    pid_ptr;     /* PTR to PID return field              */
long           rba=10;      /* relative byte to remove              */
long           len=20;      /* pointer to Number Bytes to Remove    */

  ·
  ·
  ·
if (TO2_removeRBA(pid_ptr, env_ptr, &rba, &len) == TO2_ERROR) { printf("TO2_removeRBA failed!\n"); process_error(env_ptr); } else { printf("TO2_removeRBA successful!\n"); }

Related Information