|
As always, thanks for the explanation.
I've corrected the error and am able to display to qtemp.
Frank
-----Original Message-----
From: midrange-l@xxxxxxxxxxxxxxxx
To: midrange-l@xxxxxxxxxxxx
Sent: Wed, 18 Oct 2006 6:09 PM
Subject: Re: QSH using QTEMP
fbocch2595,
(I wish I knew what to you call you, instead of fbocch2595. Do you have a
name?)
You see, QShell splits it's operation between two jobs. The interactive
job that you run the command from becomes a "terminal". Unix programs
(like those in QShell) interact with a terminal using 3 different data
streams. One for input, called STDIN, one for output called STDOUT, and a
third one for error messages called STDERR. When you run a QShell
utility, your current interactive job becomes a terminal. That terminal
takes whatever you type and sends it to the STDIN of this other,
background, job. Anything that background job writes out to STDOUT or
STDERR is copied to the screen in your interactive "terminal" job. That's
the way QShell works.
The redirection operators change all that. When you use "ls" by itself,
it prints the directory list on the screen, but when you do
"ls > /somewhere/somefile" the LS command no longer outputs to the
screen. Instead, it's output has been redirected to a file. It's never
sent to the terminal job.
When you try to redirect to QShell, as in your example
ls -c /ProgrammingArchive > /qsys.lib/qtemp.lib/myfile.file/myfile.mbr
Now you have a problem. The background job has a DIFFERENT QTEMP than
your foreground job, so this can't possibly work. The MYFILE file is in
your interactive job's QTEMP, not the background job's QTEMP. Even if you
could find a way to make it create the file in the background job's QTEMP,
it wouldn't do you any good because you'd have no way to retrieve the
data from it.
So, instead of having the background job redirect it's output to QTEMP,
you have to do it differently. In the interactive job, you say "anything
written to my STDOUT screen, put it in QTEMP". In that scenario, the
background job still thinks it's writing to the terminal, so it still
forwards it to the interactive job. In the interactive job, you have to
use OVRDBF to redirect the output.
In other words, this WON'T WORK:
QSH CMD('ls -C /programmingArchive >
/qsys.lib/qtemp.lib/test.file/test.mbr')
However, THIS WILL:
OVRDBF FILE(STDOUT) TOFILE(QTEMP/TEST)
QSH CMD('ls -C /programmingArchive')
DLTOVR FILE(STDOUT)
If you continue to use the > charcter to do the redirection, the data is
never sent to the terminal job, so there's no way it'll ever work.
I hope that makes more sense. I don't know how to explain it better.
But, rest assured, it DOES work, I use it every day.
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.