gtpc2mhd | C/C++ Language Support User's Guide |
This function returns a temporary sequence collection that contains a list of the persistent identifiers (PIDs) for the system collections in a specified data store.
Format
#include <c$to2.h> long TO2_getListDScollections (TO2_PID_PTR pid_ptr, TO2_ENV_PTR env_ptr, const char dsname[TO2_MAX_DSNAME]);
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
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.
Examples
The following example retrieves the sequence collection of data store system collections for data store CUSTOMER.
#include <c$to2.h> /* Needed for TO2 API functions */ #include <stdio.h> /* APIs for standard I/O functions */ TO2_PID pid; /* Placeholder for temporary collect */ TO2_ENV_PTR env_ptr; /* Pointer to TO2 environment */ char dsname[TO2_MAX_DSNAME]="CUSTOMER";
·
·
·
if (TO2_getListDScollections(&pid, env_ptr, dsname) ==TO2_ERROR) { printf("TO2_getListDScollections failed!\n); process_error(env_ptr); } else { printf("TO2_getListDScollections successful!\n"); }
Related Information