× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.