gtpc2mh5C/C++ Language Support User's Guide

TO2_getCollectionParts-Get the Part Names of the Collection

This function returns a temporary sequence collection containing the class names of the collection parts that were used to compose the specified collection.

Format

#include <c$to2.h>
long  TO2_getCollectionParts (TO2_PID_PTR  pid_ptr,
                              TO2_ENV_PTR  env_ptr,
                              TO2_PID_PTR  retn_pid_ptr);

pid_ptr
The pointer to a field that contains the persistent identifier (PID) of the collection that will be interrogated.

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

retn_pid_ptr
The pointer to a field where the PID of the temporary collection will be returned.

Normal Return

The normal return is a positive value and the specified TO2_PID_PTR field contains the PID of the temporary sequence collection.

The sequence collection will contain an element in the following format for each part:

    struct TO2_partList_element {     /*                             */
        long        partNumber;       /* part number of this part    */
        u_char      partNameLgh;      /* length of the part's name   */
        char        partName[ ];      /* object part's class name    *
};

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_ENV

TO2_ERROR_NOT_INIT

TO2_ERROR_PID

Programming Considerations

None.

Examples

The following example copies the part class names for a 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          objectPID;         /* target object's PID             */
TO2_PID          collectionPID;     /* return area for PID             */
 
TO2_ERR_CODE     to2_rc=1;          /* return code receiver            */
TO2_ERR_TEXT_PTR err_textPtr;       /* TO2 error code text pointer     */

  ·
  ·
  ·
{ if ((to2_rc = TO2_getCollectionParts(&objectPID, env_ptr, collectionPidPtr)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_getBLOB failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("TO2 get object parts successful\n"); }

Related Information

TO2_getClassNames-Convert EBCDIC Class Name to Index.