Operating System - OpenVMS
1827967 Members
2721 Online
109973 Solutions
New Discussion

Mailing sys$input as file

 
SOLVED
Go to solution
Mike Smith_33
Super Advisor

Mailing sys$input as file

Maybe one of you gurus can help. I have VMS 7.3-2 system. I am trying to perform a pipe of the output from dir/sin=date/sec to a mail command.

I tried along the lines of

$ pipe dire/sinc=date/sec || mail sys$input "user@email.com"


I would appreciate any advice, pipe always give me problems.
4 REPLIES 4
Hein van den Heuvel
Honored Contributor
Solution

Re: Mailing sys$input as file

Hmmm,

This works for me:

$ pipe dir *.exe | mail sys$pipe hein
Enter your message below. Press CTRL/Z when complete, or CTRL/C to quit:
New mail on node XXXX from XXXX::HEIN

Not sure how to supress that 'enter message line'
I think you would need to go into an intermediate temp file (hint: f$unique) for that.

fwiw,
Hein.

John Gillings
Honored Contributor

Re: Mailing sys$input as file

Mike,

You haven't said what does or doesn't happen with your attempted command? It might be the difference between "SYS$INPUT" and "SYS$PIPE". In some cases they're interchangeable, in others they're not. I recommend always using SYS$PIPE to refer to pipelined I/O.

(However in my tests, both SYS$PIPE and SYS$INPUT work in this instance)

To supress the "Enter your message" line, use I/O redirection:

$ PIPE DIRECTORY | MAIL SYS$PIPE user > NL:

A crucible of informative mistakes
John Gillings
Honored Contributor

Re: Mailing sys$input as file

Mike,

Doh! Just noticed you have TWO pipe characters between your directory command and MAIL. So, you're piping the output of DIRECTORY into a process with no command, and you're sending an EOF (ie: no data) into MAIL. So the output ends up on the terminal and MAIL doesn't do anything.

Drop back to ONE "|" character and it should work. (I still recommend replacing SYS$INPUT with SYS$PIPE for clarity).

A crucible of informative mistakes
Mike Smith_33
Super Advisor

Re: Mailing sys$input as file

Thanks for all the replies, I was getting the inital mail message at first. Upon trying to troubleshoot that problem I began typing in || instead of |. This caused the directory to display to my screen and not to mail me anything. Thanks for all the help.