Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

Stripping ANSI codes from output dump

Stripping ANSI codes from output dump

Problem:

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)'
test.CBL
cobrun test > OUTPUT.TXT

'Funny' characters will show up in the output file

Resolution:

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.

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2014-12-30 14:06
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.