The DBDK_TRACE_MSG() and DBDK_TRACE_ERROR() macros
When tracing is enabled, use the DBDK_TRACE_MSG() and DBDK_TRACE_ERROR() macros to write messages to the trace message file. The DBDK_TRACE_ERROR() macro also raises an error.
If tracing is not enabled, no messages are written to the trace message file; DBDK_TRACE_ERROR() still raises an error.
The
syntax for the DBDK_TRACE_MSG() and DBDK_TRACE_ERROR() macros is as
follows:
DBDK_TRACE_MSG(caller, mesgNo, level);
DBDK_TRACE_ERROR(caller, mesgNo, level);
- caller
- The name of the C routine to which you are adding the macro.
- mesgNo
- The number for an error or trace message in the syserrors or systraceclasses system
catalog. Use numbers for messages defined in the BladeSmith project
or messages BladeManager installs
with all DataBlade® modules.
See Define errors for instructions on creating error and trace messages with BladeSmith.
The standard error messages are listed in ids_dbdk_182.html#ids_dbdk_182.
- level
- An integer that determines the trace level for the message. If level is
less than or equal to the tracing threshold, then the message is printed
in the trace file. For example, the trace level for the DBDK_TRACE_ENTER()
and DBDK_TRACE_EXIT() macros is 20.
See Set a trace output file and a trace threshold for more information.
For example, if you have a function called ExmAmortize() and
a trace message number UE001 with a trace level of 20, use the following
code fragment to add tracing to the ExmAmortize() function:
DBDK_TRACE_MSG("ExmAmortize", "UE001", 20);