Controlling Output to the Current Device
This page describes how the Work Queue Manager handles output written to the current device. By default, if work items generate output (WRITE statements) to the current device, the work queue saves the output in a buffer until the end of WaitForComplete() or Wait(). If you want a work item to generate output earlier, have that work item call the Flush() class method of the %SYSTEM.Context.WorkMgr class, for example:
set sc = $system.Context.WorkMgr().Flush()
When the work item calls this method, that causes the parent work queue to write all saved output for the work item.
Additionally, you can use the -d flag to suppress all output to the current device. In this case, the Flush() method does nothing, because there is no output.