gtpc2mhu | C/C++ Language Support User's Guide |
This function migrates the TPF collection support (TPFCS) system
collections in a particular data store to the current TPFCS collection format
with new pool addresses assigned to the collections.
Format
#include <c$to2.h>
long TO2_migrateDS (TO2_PID_PTR pid_ptr,
TO2_ENV_PTR env_ptr,
const char dsname[TO2_MAX_DSNAME]);
- pid_ptr
- A pointer to the field that holds the returned persistent identifier (PID)
assigned to the temporary sequence collection that contains a list of the PIDs
of the system collections before this function was called.
- 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
migrated. 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. The sequence collection referred to by
pid_ptr contains one element per system collection. The
format of the data area of the element is as follows:
struct TO2_dsCollection_element
{
TO2_PID collectionPID[TO2_MAX_PID_SIZE];
};
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 re-creates the system collections contained in the data
store and copies the contents of the old system collections to the new system
collections one element at a time.
- You must migrate all user collections in the data store by using the
TO2_migrateCollection function call. You also must delete
the list of old system collections returned by this function by using the
TO2_deleteCollection function call, or otherwise process the list
of old system collections returned by this function.
- Enter an explicit TO2_deleteCollection function call when you
have completed processing the returned temporary collection even though the
temporary collection is automatically deleted when the entry control block
(ECB) exits. This action ensures that system resources used by that
collection are cleanly released back to the system for reuse.
- A commit scope will be created for the TO2_migrateDS
request. If the request is successful, the scope will be
committed. If an error occurs while processing the
TO2_migrateDS request, the scope will be rolled back.
Examples
The following example migrates data store TESTX.DS.
#include <c$to2.h> /* Needed for TO2 API functions */
#include <stdio.h> /* APIs for standard I/O functions */
TO2_PID pid; /* Holder for temporary sequence collect */
TO2_ENV_PTR env_ptr; /* Pointer to TO2 environment */
char dsname[TO2_MAX_DSNAME]="TESTX.DS";
·
·
·
if (TO2_migrateDS(&pid, env_ptr, dsname) == TO2_ERROR)
{
printf("TO2_migrateDS failed! \n");
process_error(env_ptr);
}
else
{
printf("TO2_migrateDS successful! \n");
}
/* Process the elements in the returned sequence collection */
Related Information
See TPF Application Programming for more
information about commit scope.