TDINFRPC  TDINFUDT

Chapter 3: Functions

TDINFSPT

Description

Indicates whether tracing is on or off for a specified transaction.

Syntax

%INCLUDE SYGWPLI;
01 IHANDLE               PTR,
01 RETCODE               FIXED BIN(31),
01 TRACE_STATUS          FIXED BIN(31),
01 TRACE_OPTION          FIXED BIN(31),
01 TRANSACTION_ID        CHAR(n),
01 TRANSACTION_ID_LENGTH FIXED BIN(31);
CALL TDINFSPT (IHANDLE, RETCODE, TRACE_STATUS,
                TRACE_OPTION, TRANSACTION_ID, 
                TRANSACTION_ID_LENGTH);

Parameters

IHANDLE

(I) A transaction-wide structure that contains information used to set up the Gateway-Library environment. This must be the same IHANDLE specified in the program’s initial TDINIT call. It corresponds to the context structure in Open Client Client-Library.

RETCODE

(O) Variable where the result of function execution is returned. Its value is one of the codes listed in Table 3-20.

TRACE_STATUS

(O) Variable where the trace indicator for the specified transaction is returned. This is a Boolean value that indicates whether tracing is on or off for the transaction specified in this function.

This argument returns one of the following values:

TDS_TRUE (1)

Tracing is on for this transaction.

TDS_FALSE (0)

Tracing is off for this transaction.

TRACE_OPTION

(O) Variable where the type of tracing enabled for the specified transaction is returned. This argument returns one of the following values:

TDS_SPT_API_TRACE (0x08)

All Gateway-Library calls are traced.

TDS_SPT_ERRLOG (0x02)

Error log recording is enabled.

TDS_SPT_TDS_DATA (0x01)

TDS packet-tracing recording is enabled.

TRANSACTION_ID

(I) Mainframe transaction identifier of the transaction for which the trace status is requested.

Under CICS: This is the TRANSID from the CICS Program Control Table (PCT).

Under IMS TM: This is the transaction name defined when the system is generated.

Under MVS: This is the APPC transaction name defined in the transaction profile.

TRANSACTION_ID_LENGTH

(O) Variable where the length of the TRANSACTION_ID is returned. For graphic datatypes, this is the number of double-byte characters; for other datatypes, it is the number of bytes.

Under CICS: For CICS Version 1.7, this value is always 4 or less. For later versions, it is the actual length of the transaction ID, which can be greater than 4.

Under IMS TM: This value is always 8 or less.

Under MVS: This is the APPC transaction name defined in the transaction profile. This value is normally 8 or less.

Returns

The RETCODE argument can contain any of the return values listed in Table 3-20.

Table 3-20: TDINFSPT return values

Return value

Meaning

TDS_OK (0)

Function completed successfully.

TDS_INVALID_IHANDLE (-19)

Invalid IHANDLE specification. Error in specifying a value for the IHANDLE argument.

TDS_INVALID_PARAMETER (-4)

Invalid parameter value. The value assigned to one or more of the arguments supplied in the call is not valid. The operation failed.

Examples

Example 1

The following code fragment illustrates the use of TDINFSPT to determine whether tracing is enabled for a particular transaction. This example is taken from the sample program in Appendix G, “Sample Tracing and Accounting Program” which runs under CICS.

 	 /*------------------------------------------------------------*/
	GET_TRACE_STATUS: PROC;
 	 /*------------------------------------------------------------*/
 
	 /*      ------------------------------------------------------*/
  	 /*      find global status                                    */
  	 /*      ------------------------------------------------------*/
          CALL TDINFLOG (GWL_INIT_HANDLE, GWL_RC,
                         GWL_INFLOG_GLOBAL,
                         GWL_INFLOG_API,
                         GWL_INFLOG_HEADER,
                         GWL_INFLOG_DATA,
                         GWL_INFLOG_TRACEID,
                         GWL_INFLOG_FILENAME,
                         GWL_INFLOG_RECORDS);
  	 /*      ------------------------------------------------------*/
  	 /*      if any error, then assume tracing disabled            */
  	 /*      ------------------------------------------------------*/
          IF GWL_RC NE TDS_OK THEN
          DO;
              SEND_DONE       = SEND_DONE_ERROR;
              MSG_SRVLIB_FUNC = 'TDINFLOG';
              GO TO GET_TRACE_STATUS_EXIT;
          END;
 
  	 /*      ------------------------------------------------------*/
  	 /*      if global tracing on, then tracing enabled            */
  	 /*      ------------------------------------------------------*/
          IF GWL_INFLOG_GLOBAL = TDS_TRACE_ALL_RPCS THEN
          DO;
              TRACING = TRACING_ON;
              GO TO GET_TRACE_STATUS_EXIT;
          END;
  	 /*      ------------------------------------------------------*/
  	 /*      if error logging on, then tracing enabled             */
  	 /*      ------------------------------------------------------*/
          IF GWL_INFLOG_GLOBAL = TDS_TRACE_ERRORS_ONLY THEN
          DO;
 
              TRACING = TRACING_ON;
              GO TO GET_TRACE_STATUS_EXIT;
          END;
 
 
  	 /*      ------------------------------------------------------*/
  	 /*      if specific tracing not on, then no tracing on        */
  	 /*      ------------------------------------------------------*/
          IF GWL_INFLOG_GLOBAL NE TDS_TRACE_SPECIFIC_RPCS THEN
          DO;
              GO TO GET_TRACE_STATUS_EXIT;
          END;
  	 /*      ------------------------------------------------------*/
  	 /*      specific tracing is on, see if on for this transaction*/
  	 /*      ------------------------------------------------------*/
          WRKLEN1 = STG(WRK_RPC);
 
          CALL TDINFSPT (GWL_INIT_HANDLE, GWL_RC,
                         GWL_INFSPT_STATUS,
                         GWL_INFSPT_OPTIONS,
                         WRK_RPC,
                         WRKLEN1);
 
          IF (GWL_RC NE TDS_OK AND GWL_RC NE TDS_ENTRY_NOT_FOUND) THEN
          DO;
              SEND_DONE       = SEND_DONE_ERROR;
              MSG_SRVLIB_FUNC = 'TDINSPT';
              GO TO GET_TRACE_STATUS_EXIT;
          END;
 
          IF GWL_INFSPT_STATUS = TDS_TRUE THEN
          DO;
              TRACING = TRACING_ON;
          END;
 
  	 /*------------------------------------------------------------*/
	GET_TRACE_STATUS_EXIT:
  	 /*------------------------------------------------------------*/
          RETURN;
 
	END GET_TRACE_STATUS;

Usage


TDINFSPT

This function indicates whether tracing for a specified transaction is currently on or off.

See also

Related functions

Related documents





Copyright © 2005. Sybase Inc. All rights reserved. TDINFUDT

View this book as PDF