I think you might want to use this:
STARTVARLOG (Statement) [Version 2.7 or later]
Start a variable log.
STARTVARLOG
This statement specifies the start of variable logging in programs.
Transmitting the variable log to WINCAPS III allows the log to be browsed.
This statement logs only variables that are added to the Watch list and selected in the Log column in WINCAPS III. (Ver. 2.7 or later)
STOPVARLOG, CLEARVARLOG
CLEARVARLOG 'Clear variable log data
STARTVARLOG 'Start a variable log
······
In operation
······
STOPVARLOG 'Stop a variable log