Highlighted
Knowledge Partner
Knowledge Partner
194 views

Runcobol redirect output to a file on Windows

Jump to solution

Hi,

In the past it was normal tu use > to redirect DISPLAYs to a file like runcobol myprogram > myoutput.txt, but this is not working anymore under Windows. Is it possible to redirect the output to a file on Windows like on Linux?

Regards,

 

Juan Manuel Urraburu
Director of Technology @ ProRM & Axtrio
Micro Focus Knowledge Partner
LinkedIn

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert
Hi Juan:

I suggest you put in an enhancement request for screen I/O redirection and/or the ability to run RMCOBOL programs in a Windows console.

View solution in original post

0 Likes
5 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Juan:

Graphical Windows programs like the RM/COBOL runtime don't have the concept of terminal I/O redirection.  Redirection is possible in UNIX and Windows console programs because the console/screen/command window is just another stream device that data is written to. So it's simple to redirect the output to a different device and send the data to a file instead of the screen.

The methods that graphical programs use to handle the display are completely different, and cannot be redirected into a file.  If this was possible, the written data wouldn't make any sense. 

Also, Windows programs are generally launched from icons, and Windows does not support the "> >>  <" redirection operators except for programs running under CMD.EXE.

It is possible for Windows programs to internally simulate this kind of redirection, but RM/COBOL for Windows has never done that.  You'd have to go back to the DOS Extender-based version 6 to get this feature and I doubt it would run on any version of Windows.

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Hi Uwe, I hope  you are fine!

The reason to use output redirection is for QA purposes, to check functions and then analize the content of the file to look for fails in it. It seems RM is the only one that does not support this under Windows. It works with Acu and MF. I will think on a way to capture those displays.

Best regards,

 

Juan Manuel Urraburu
Director of Technology @ ProRM & Axtrio
Micro Focus Knowledge Partner
LinkedIn

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Well it seems Acu also generates an empty file on Windows.

Juan Manuel Urraburu
Director of Technology @ ProRM & Axtrio
Micro Focus Knowledge Partner
LinkedIn

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

Hi Juan:

I'm doing well -- hope you are too.

The behavior you described, producing an empty file, is what I'd expect if you launch any GUI program from the command line. 

For example, on Windows, running this command:

RUNCOBOL program >output.txt

will produce an empty output.txt file.  The reason is that Windows CMD.EXE parses the command line, redirects standard the standard output file handle into output.txt (creating or overwriting the file), then launches RUNCOBOL.EXE as a GUI program.  GUI programs do not have access to these file handles so the file remains empty.

I believe that ACU does provide a console runtime system on Windows that presumably uses stdin/stdout/stderr; RM/COBOL includes a console-mode compiler but not a runtime system.

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert
Hi Juan:

I suggest you put in an enhancement request for screen I/O redirection and/or the ability to run RMCOBOL programs in a Windows console.

View solution in original post

0 Likes
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.