Back on November 1, I exhorted all REXX programmers to always make it possible to turn TRACE on via a parameter rather than making a code change to the program itself. There are many good reasons to support that position philosophically, but there's one that makes all others pale in comparison. When you can turn TRACE on remotely, you can trap the entire output of your program as it runs in TRACE.
You set up an OUTTRAP, issue the command, and close the OUTTRAP when it finishes. 'Issuing the command' in this case means calling the routine in such a way that TRACE is on. If you can't turn on TRACE with a parameter, you add an entire layer of complexity that doesn't need to be there. If you're in tune with REXXSKEL, it's as simple as
rc = Outtrap("OUT.") (TSOCMD) "(( TRACE R" rc = Outtrap("OFF")
Now, the entire TRACE output is stored in stem 'out.' (here's hoping you didn't blow out of your TSO region in the process...) and all that's left is to allocate a dataset to hold it, then
"EXECIO" out.0 "DISKW TRAPOUT (STEM OUT. FINIS"
If you allocated the dataset large enough (I always ask for 'CYL,(5,5)') you now have a browseable dataset showing every last line of execution right up to the point of failure. You'll thank me for this when your routine crashes trying to process record number 11,728.
Over on my REXX page you'll find 'TRAPOUT' that implements this simple, straight-forward method for anyone whose code can be coaxed into running in TRACE :-)
that's cool... I will try this.
ReplyDelete