HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

redirect sys$output

Frequent Advisor

redirect sys$output

Dear VMS Users,

I want to do this in VMS: put the output of this command to fileA_diff file. How to achive that?

difference fileA,c fileA_new.c


John Gillings
Honored Contributor

Re: redirect sys$output


There are lots of ways to redirect output. For many commands there is a /OUTPUT qualifier to direct output to a file. DIFFERENCE has one, so the simplest answer is:

$ DIFFERENCE/OUTPUT=fileA_diff fileA.c fileA_new.c

For commands that don't have a /OUTPUT qualifier, try:

$ DEFINE/USER SYS$OUTPUT output_file.txt
$ command


$ PIPE command > output_file.txt

or (if you want to capture the output of several commands)

$ @TT/OUTPUT=output_file.txt
_$ command
_$ another command
_$ etc...
$ TYPE output_file.txt

A crucible of informative mistakes
Honored Contributor

Re: redirect sys$output

Redirection is a Unix solution, and doesn't work quite the same (or quite as well) on OpenVMS. And it doesn't necessarily lend itself quite as well to Unix-style solutions.

Redirection or the parsing of command output is often not a good solution, though (as mentioned in the previous reply) it is often feasible. Its not good because the formats of the commands can potentially change.

For the DCL command verb in this case, and many others, the command has an /OUTPUT qualifier. DIFFERENCES /OUTPUT. As was mentioned. HELP DIFFERENCES can provide you with substantial information, and most DCL verbs have on-line help text at least on par with and sometimes rather better than man pages.

I'd suggest a quick tour through the OpenVMS User's Guide, as that can provide some insight into how OpenVMS and DCL works.

So what are you up to here with the DIFFERENCES command itself?
Frequent Advisor

Re: redirect sys$output