TDWRTLOG

Description

Writes a user-created message or a system entry to the trace and error log.

Syntax

% INCLUDE SYGWPLI;
01 TDPROC         PTR,
01 RETCODE        FIXED BIN(31),
01 DATETIME_FLAG  FIXED BIN(31),
01 MESSAGE        CHAR(n),
01 MESSAGE_LENGTH FIXED BIN(31);
CALL TDWRTLOG	(TDPROC, RETCODE, DATETIME_FLAG,
                 MESSAGE, MESSAGE_LENGTH);

Parameters

TDPROC

(I) Handle for this client/server connection. This must be the same value specified in the associated TDACCEPT call. The TDPROC handle corresponds to the connection and command handles 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-47.

DATETIME_FLAG

(I) Timestamp indicator. This flag indicates whether or not the log message should begin with the current date and time. Assign this argument one of the following values:

TDS_TRUE (1)

Include date and time.

TDS_FALSE (0)

Do not include date and time.

MESSAGE

(I) User-written message. This is the text of the message to be written to the trace file.

MESSAGE_LENGTH

(I) Length of the user-written message. The message must be less than or equal to 80 bytes in length. For graphic datatypes, this is the number of double-byte characters; for other datatypes, it is the number of bytes.

Returns

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

Table 3-47: TDWRTLOG return values

Return value

Meaning

TDS_OK (0)

Function completed successfully.

TDS_LOG_ERROR(-258)

Attempt to write to the log file failed.

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.

TDS_INVALID_TDPROC (-18)

Error in specifying a value for the TDPROC argument.

TDS_WRONG_STATE (-6)

This function cannot be used in the current communication state. For example, your program tried to send a reply before it read in all of the client parameters. The application was still in RECEIVE state and could not send. The operation failed.

Examples

Example 1

The following example writes an entry to the trace log after checking to see that tracing is enabled. It is taken from the sample program in Appendix G, “Sample Tracing and Accounting Program,” which runs under CICS.

/*--------------------------------------------------------------------*/ 
	TDWRTLOG_PROC: PROC; 
	/*-----------------------------------------------------------------*/ 
	/*      -----------------------------------------------------------*/ 
	/*      Write a log entry only if logging is enabled.              */ 
	/*      -----------------------------------------------------------*/ 
         	CALL GET_TRACE_STATUS; 
         IF (TRACING) THEN 
         DO; 
             CALL TDWRTLOG (GWL_PROC, GWL_RC,  
                            TDS_TRUE, 
                            GWL_WRTLOG_MSG,    
                            GWL_WRTLOG_MSG_L); 
             IF GWL_RC NE TDS_OK THEN 
             DO; 
                 SEND_DONE       = SEND_DONE_ERROR; 
                 MSG_SRVLIB_FUNC = 'TDWRTLOG'; 
                 GO TO TDWRTLOG_EXIT; 
             END; 
         END; 
         ELSE 
         DO; 
             SEND_DONE       = SEND_DONE_ERROR; 
             MSG_SRVLIB_FUNC = 'LOGNOTON'; 
             GO TO TDWRTLOG_EXIT; 
         END; 
 /*------------------------------------------------------------------*/ 
 TDWRTLOG_EXIT: 
 /*------------------------------------------------------------------*/ 
         RETURN; 
 END TDWRTLOG_PROC;

Usage


TDWRTLOG

You use this function to write a message to the trace and error log.

See also

Related functions