Writes a user-created message or a system entry to the trace and error log.
% 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);
(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.
(O) Variable where the result of function execution is returned. Its value is one of the codes listed in Table 3-47.
(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. |
(I) User-written message. This is the text of the message to be written to the trace file.
(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.
The RETCODE argument can contain any of the return values listed in Table 3-47.
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. |
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;
You use this function to write a message to the trace and error log.
Traces and error messages are written to the same log. The transaction processing system determines the log used for tracing and the type of tracing being done. Also, the log must be open for this function to execute successfully.
Under CICS. The trace and error log is a VSAM ESDS file.
As installed, the CICS trace log is named SYTDLOG1. You can change the name of this file with TDSETLOG. To find out the name of the current trace log, use TDINFLOG.
TDSETLOG opens the trace and error log when it turns tracing on.
Under IMS TM. Header, data, and API tracing information are all written to the IMS TM system log.
The IMS TM system log is always open, but TDSETLOG does a logical OPEN by turning tracing on.
Under MVS. The information is written to a sequential file.
Gateway-Library opens the log, but TDSETLOG does a logical OPEN by turning tracing on.
This function can be used to send local messages to
the trace and error log even when the connection is down.
Related functions