gtpc2mi4C/C++ Language Support User's Guide

TO2_setMethodTrace-Set Method Trace On or Off

This function sets the TPF collection support (TPFCS) method trace function on or off. The state of the method trace is saved and restored after every IPL.

Format

#include <c$to2.h>
long  TO2_setMethodTrace (TO2_ENV_PTR  env_ptr,
                          char        *state[]);

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

state
A pointer to a character string that contains one of the following values:

ON
Set method trace on.

OFF
Set method trace off.

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_ENV

TO2_ERROR_NOT_INIT

TO2_ERROR_PARAMETER

Programming Considerations

By issuing a TO2_getClassAttributes request for class, TPFCS will retrieve the current attribute value for the method trace.

Examples

The following example sets the method trace attribute state to ON.

#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      */
 
char             methodTraceOn[3]="ON"; /* turn method trace on            */
TO2_ERR_CODE     to2_rc=1;              /* return code receiver            */
TO2_ERR_TEXT_PTR err_textPtr;           /* TO2 error code text pointer     */

  ·
  ·
  ·
{ if ((to2_rc = TO2_setMethodTrace(env_ptr, methodTraceOn)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_setMethodTrace failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("TO2 Method Trace turned ON\n"); }

The following example sets the method trace attribute state to OFF.

#include <c$to2.h>                        /* Needed for TO2 API Functions  */
 
TO2_ENV_PTR      env_ptr;                 /* Pointer to TO2 environment    */
 
char             methodTraceOff[4]="OFF"; /* turn method trace off         */
TO2_ERR_CODE     to2_rc=1;                /* return code receiver          */
TO2_ERR_TEXT_PTR err_textPtr;             /* TO2 error code text pointer   */

  ·
  ·
  ·
{ if ((to2_rc = TO2_setMethodTrace(env_ptr, methodTraceOff)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_setMethodTrace failed, error code - %d\n ", to2_rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("TO2 Method Trace turned OFF\n"); }

Related Information