× 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.



hi Lim,

Not in all cases.

QtmhWrStout always writes to stdout. write(1: ....) always writes to descriptor 1. But they aren't always the same thing.

If I understand correctly, the original implementation of C on OS/400 didn't have descriptors. So stdin, stdout, stderr were not associated with a particular file descriptor.

Later, when descriptor support was added, IBM had to deal with the fact that some people expected 0,1,2 to be mapped to stdin,stdout,stderr (because that's how Unix works). So they invented an environment variable, QIBM_USE_DESCRIPTOR_STDIO that controls this.

Furthermore, 0,1,2 always match stdin, stdout, stderr when you are in QShell or PASE. I believe they also do when you are communicating with the HTTP server (i.e. CGI programming)

But there are situations where they don't match, such as in the native ILE environment (interactive or batch job) or when spawning a child job manually via the spawn() API and mapping pipes to descriptors 0,1,2, or when starting Java directly from RPG. In those cases, you have to set the QIBM_USE_DESCRIPTOR_STDIO variable...



hockchai Lim wrote:
is it correct for me to assume that write() (using handle ID of 1) and QtmhWrStout essentially does the same thing of writing the data to stdout?

thanks





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.