gtpc2mgyC/C++ Language Support User's Guide

TO2_getClassAttributes-Get Attributes of a Class

This function returns a sequence collection of the EBCDIC names of the class attributes and the values for the class.

Format

#include <c$to2.h>
long  TO2_getClassAttributes (TO2_PID_PTR   pid_ptr,
                              TO2_ENV_PTR   env_ptr,
                              const long   *class_namelength,
                              const char    class_name[TO2_MAX_CLASS_NAME]);

pid_ptr
The pointer to where to return the temporary persistent identifier (PID) assigned to the sequence collection of attributes.

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

class_namelength
The pointer to a long integer, which contains the length of the input class name.

class_name
The character string class name that will be interrogated.

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_NO_ROOM

TO2_ERROR_INVALID_DATA_LGH

Programming Considerations

None.

Examples

The following example retrieves the PID for the class name indicated.

#include <c$to2.h>             /* Needed for TO2 API functions    */
#include <stdio.h>             /* APIs for standard I/O functions */
 
long         err_code;
TO2_ENV_PTR  env_ptr;          /* Pointer to TO2 environment      */
TO2_PID      collect;
char         *class_name;
long         classname_length;

  ·
  ·
  ·
if (TO2_getClassAttributes(&collect, env_ptr, &classname_length, class_name) == TO2_ERROR) { err_code = TO2_getErrorCode(env_ptr); { printf("TO2_getClassAttributes failed!\n"); process_error(env_ptr); } else { printf("TO2_getClassAttributes successful!\n"); } }

Related Information