The WrtTrace procedure is a utility to output a string the trace area..
The WrtTrace procedure can send a string of text to the job's trace area as an informational message. Up to 16 optional substitution variable may be specified and inserted in the the message text at runtime.
void WrtTrace( szMsg * Value OPTIONS(*STRING) szSubstitutionValue1 * Value OPTIONS(*STRING : *NOPASS) szSubstitutionvaluen... * Value OPTIONS(*STRING : *NOPASS) ... up to 16 substitution values may be specified ) |
|
See also: wrtJoblog |
The return value is *ON ('1') is the procedure was successful, otherwise *OFF ('0') is returned.
The trace area is a system object created by IBM. It is a user space created in the QUSRSYS library for each job. When a program calls one of the trace interfaces, a user space named QP0Zxxxxxx (where xxxxxx is the job number) is created in QUSRSYS. The WrtTrace RPG xTools is used to write entries into this trace area. The trace area survives even when the job ends. Compare this with a joblog that may or may not be saved when the job ends.
Use the OS/400 DMPUSRTRC CL command to dump (i.e., list) the trace data.
.....C*Rn01..............OpCode(ex)Extended-factor2++++++++++++++++++++++++++
C callp WrtTrace('Cust %s Balance due: %s' :
C %char(CustNo) : %char(BALDUE))
In this example the two numeric values CUSTNO and BALDUE are coverted to character using %CHAR and used as substitution values in the Trace string. Of course non-numeric values may be specified without enclosing them in the %CHAR built-in function.