Operating System - HP-UX
1833738 Members
2410 Online
110063 Solutions
New Discussion

Solaris /dev/stdout equivalent for HP-UX? (NOT /dev/tty)

 
SOLVED
Go to solution
Chris_130
Occasional Contributor

Solaris /dev/stdout equivalent for HP-UX? (NOT /dev/tty)

I am moving an Informix SE database from Solaris to HP. Many of the SQL scripts use a line like UNLOAD TO /dev/stdout DELIMITER "," to set a useful delimiter to use. When the SQL scripts are used the output is redirected as desired. Some scripts are used twice and output to different files for comparison. Informix SE's dbaccess won't take a variable being passed in like $SYSOUT. I talked to Informix and another admin here and I have some workarounds, but the key word is WORK; all the scripts would need to be changed. The absolute best solution would be a /dev/stdout equivalent for HP-UX. Any ideas?
3 REPLIES 3
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Solaris /dev/stdout equivalent for HP-UX? (NOT /dev/tty)

HP-UX doesn't have a /dev/stdout and you have probably learned a valuable lesson now. Don't never ever hardcode nothing unless you know it's supported across all possible platforms.

Here's the best I have been able to come up with, a named pipe equivalent:

mkfifo -m 666 /dev/stdout

Now start a process to grab the input of this pipe.

tail -f /dev/stdout > /var/tmp/myfile.tmp &

You should then be able to use /dev/stdout in your scripts.

The downside to this workaround is that unlike a real /dev/stdout device node; all processes which write to /dev/stdout will dump to the same pipe so that outputs from multiple processes might be interleaved.


If it ain't broke, I can fix that.
Chris_130
Occasional Contributor

Re: Solaris /dev/stdout equivalent for HP-UX? (NOT /dev/tty)

Clay,

stdin, stdout, stderr: I thought they were standard when I created them years ago, but I now know better. The named pipe trick was exactly what the other admin here had suggested and I do think it will work. Thanks for the confirmation.

Chris
Chris_130
Occasional Contributor

Re: Solaris /dev/stdout equivalent for HP-UX? (NOT /dev/tty)

Solution by Clay is worked well enough for a quick fix. I "wrapped" the sql scripts with a perl program to replace /dev/null with the name of a file on execution as a longer term solution.