Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Output from command procedure to both screen and log file

 
SOLVED
Go to solution
Steven Watson
Occasional Contributor

Output from command procedure to both screen and log file

Hello everyone:

How do I get a command procedure to output to both the screen and a log file at the same time? Using /OUTPUT only goes to the log file and nothing is displayed on the screen.

Thanks,

Steven
4 REPLIES 4
Hein van den Heuvel
Honored Contributor

Re: Output from command procedure to both screen and log file

Steven,

Welcome to the HP TIRC Forum for OpenVMS.

I tend to use terminalor emulators configured with 5000 or more scroll lines.

For more procedural cases I use SET HOST /LOG

But you probably are not interested in that.

I suspect that $PIPE ... command .. @TEE is what you need.

Please check out $HELP PIPE examples

hth,
Hein.

Heinz W Genhart
Honored Contributor

Re: Output from command procedure to both screen and log file

Hi Steven

You can use pipe and the tee.com commandfile to solve this.

See

Help pipe examples

Example 5 describes something very similar to your requirement.

Hope that helps

Regards

Geni
Heinz W Genhart
Honored Contributor
Solution

Re: Output from command procedure to both screen and log file

Hi Steven

here a example solution for your problem:

$ ! TEE.COM - command procedure to display/log data flowing through
$ ! a pipeline
$ ! Usage: @TEE log-file
$
$ OPEN/WRITE tee_file 'P1'
$ LOOP:
$ READ/END_OF_FILE=clean_up SYS$PIPE line
$ WRITE SYS$OUTPUT line ! Send it out to next stage of the pipeline
$ WRITE tee_file line ! Log output to the log file
$ GOTO LOOP
$clean_up:
$ CLOSE tee_file
$ EXIT

As an example, how to use it:

$ PIPE dcl-command | @tee logfile-name

$ PIPE DIR | @tee test.log

Regrads

Geni
Steven Watson
Occasional Contributor

Re: Output from command procedure to both screen and log file

Thanks all, TEE.COM solved the problem for me.

Steven