Stripping ANSI codes from output dump
When using the (RM) variable and sending the screen output to a dump file, the generated file includes not only "text" but ANSI codes (unexpected or 'funny' characters).
It gives the 'header - funny characters' with the RM directive. Using MF directive it is all ok.
cob -v -C DIALECT'(RM)'
cobrun test > OUTPUT.TXT
'Funny' characters will show up in the output file
The 'funny' characters are terminal control characters, used to clear the screen, position the cursor at the upper-left prior to the display, and to restore the screen to its former state after the program terminates.
This is the default behavior of DISPLAYs in the RM world.
One way to inhibit this would be to add UPON SYSOUT (or UPON CONSOLE) to the DISPLAY statements:
DISPLAY "LINEA 1" UPON SYSOUT.
DISPLAY "LINEA 2" UPON SYSOUT.
In Visual COBOL you can use the directive DISPLAY(CONSOLE) to force all unqualified DISPLAY statements to effectively be UPON CONSOLE.