|
James, Scott, Jim. Thanks. I'm aware that OS like Unix and the C (or C++) language provide an operator that permits the output of one program to be easily piped to another but the challenge is to prove that this can be achieved effectively on OS/400 since the analagous facility to override stdout appears to be ignored when the QtmhWrStout Api is used to generate stdout. Populating stdout from within an RPGLE cgi program (or C) is a relatively simple matter using the built-in Apis or functions that the language provides since this is how all CGI programs are written. I suspect that James's explanation that stdout does not actually exist as a file may be the reason that the concept of subsequently opening it is not possible. The piping technique would therefore appear be a mechanism the merely primes the OS before making a program call so that it bypasses the usual low level process that generates stdout and instead passes the output stream to a redirected actual file that is available for read. I'm inclined to agree that this cannot be done (unless emulating popen() and pclose() is worth a look.) Cheers, Peter -----Original Message----- From: James Rich [mailto:james@eaerich.com] Sent: Monday, April 15, 2002 7:36 PM To: 'rpg400-l@midrange.com' Subject: RE: STDIN, STDOUT, STDERR in RPG On Mon, 15 Apr 2002, Peter Connell wrote: > Forgive me for mentioning this again. You may have spotted a recent question > I posed that asks if stdout (not stdin) can be read into an RPGLE pgm after > some previous process has already populated it via an api like QtmhWrStout. > Can this be done? I know I'm not Scott but you get to hear from me anyway :) I believe the straightforward answer to this is no. For a more in depth discussion on how stdin and friends work see the reply I just wrote to David's question. Using pipes one program's stdout can be read by another program's stdin. I think you are trying to accomplish this reading without using a pipe, which I believe cannot be done. But there is a bigger problem with your question. stdout is not something that can be populated. If there is something to read it (using a pipe) then fine, or it can be printed on the screen, or it can be redirected to a file. But stdout is not saved or stored anywhere. It never fills up or gets empty. So you can't have one program write some stuff to its stdout and then fire up another program and read the first's stdout. stdin, stdout, and stderr aren't real files. They only exist in the mind of the operating system. To do what you want you should use a pipe. James Rich james@eaerich.com _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l or email: RPG400-L-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. This communication is confidential and may be legally privileged. If it is not addressed to you, you are on notice of its status. Please immediately contact us at our cost and destroy it. Please do not use, disclose, copy, distribute or retain any of it without our authority - to do so could be a breach of confidence. Thank you for your co-operation. If you need assistance, please contact Baycorp Advantage on either :- Australia 133124 or New Zealand +64 9 356 5800 All personnel email addresses must be in the format 'firstname.lastname@baycorpadvantage.com'. * Old Baycorp email addresses will cease to exist after June 1st 2002 *
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.