gtpc2mgnC/C++ Language Support User's Guide

TO2_convertClassName-Convert EBCDIC Class Name to Class Index

This function converts an EBCDIC class name to its corresponding class index.

Format

#include <c$to2.h>
long  TO2_convertClassName (      TO2_ENV_PTR  env_ptr,
                            const long        *classNameLength,
                            const char         className[TO2_MAX_CLASS_NAME]);

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

classNameLength
The pointer to the length of the input class name.

className
The pointer to a character string, which is the name of the class that will be converted.

Normal Return

The normal return is the class index of the class name passed as a parameter.

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 code is common for this function:

TO2_ERROR_CLASS_NOTFOUND

Programming Considerations

None.

Examples

The following example converts the class name provided into a class index.

#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      */
char         *class_name;
long         classNameLength;

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

Related Information

TO2_getClassNames-Convert EBCDIC Class Name to Index.