The REXX Interpreter writes the debug output (switched on with the TRACE function or keyword) to STDERR. To redirect this output into a file use
myProgram 2>>trace.out
To get the trace output on the screen and into a file at the same time (while your REXX program is running) you may use a TEE program:
myProgram 2>>&1 | tee trace.out
"Note that VX-REXX programs 'hang' when RXTRACE=ON is set.
If RXTRACE=ON is set for REXX programs and STDERR is redirected (i.e 2>file_name), the effect of RXTRACE=ON is the same as TRACE R having been issued at the beginning of the REXX program (i.e., the trace is NOT interactive)."
(Source: Dick Goran, (see Internet - Web Pages))
The same is true for using the function TRACE in a REXX program and redirecting STDERR of the REXX program into a file.
(see also Special environment variables for REXX programs)