|
Scott, 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? Cheers, Peter -----Original Message----- From: Scott Klement [mailto:klemscot@klements.com] Sent: Sunday, April 14, 2002 4:19 PM To: rpg400-l@midrange.com Subject: Re: STDIN, STDOUT, STDERR in RPG In Unix, 0=stdin, 1=stdout, 2=stderr. That's a standard. They are opened when you log on to the machine, and usually stay open until you log off. You don't generally need to open or close them. I believe they're opened by the getty process, which connects them to the tty, but I don't know that for sure, and at any rate is probably irrelevant to you :) You don't open or close them within your program. They are simply adopted from your parent process. Of course, OS/400 is not Unix. Simply calling an RPG program from the command line does not open those 3 streams. However, if you ran your program from within QSH or a C program, the OS would probably have already opened them for you. When I wrote you that sample of calling QzshSystem(), I opened them within my RPG program because my purpose in using this API was to avoid having to start QSH before running my program. Of course, if you ran that same program from within a process that already had those streams open, it'd cause problems. On Sat, 13 Apr 2002, David Morris wrote: > Group, > > While testing these files in an RPG program I came upon something > strange. First, here are some assumptions that may not be valid: > > STDIN should be assigned a handle of 0, STDOUT 1, and STDERR 2. At least > that is what the PASE manual says. > > You should close these if you open them when your process is completed, > this just seems like a good practice. > > I found something strange. With QSH it opens a single file at 0 if > possible, but it will use anything if 0 is not available. QSH closes > this file when you press F3. Debug does not operate this way. Debug > appears to 0,1,2 and never close them. > > How does a unix utility like grep locate STDIN, STDOUT, and STDERR? Does > it use the file handle 0,1,2 or some other means? > > Thanks, > > David Morris _______________________________________________ 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-2024 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.