× 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 Sean,

QP2SHELL is really just a wrapper around Qp2RunPase to simplify it.

In an interactive job, the ILE C stdio descriptors should map to the screen. In a batch job, they'll go to a spooled file, instead.

If you wish to use either the Qp2RunPase or QP2SHELL API, I would recommend setting up descriptors properly. To do that, you should use the pipe() API to create at least 2 descriptors (maybe 3 if you want to keep stderr/stdout separate.) Then use the spawn() API to create a new job where the proper end of the pipe is associated with the proper descriptors in the new job.

I do have an open source implementation of this spawn/pipe technique called "UNIXCMD", which also interfaces with an RPG SPECIAL file to make it as simple as possible.
http://www.scottklement.com/unixcmd

An IBMer named Tony Cairns also created one named popen that does the same thing -- though, unsurprisingly, I like mine better :-)
http://174.79.32.155/wiki/index.php/RPGpopen/RPGpopen

But, of course you can write it yourself using pipe/spawn, too.

Or, as I said in the last e-mail, you can simply call the QSH/STRQSH command instead of using QP2SHELL or Qp2RunPase. STRQSH takes care of the pipes for you (but the disadvantage is you can't read the output directly into a program, you have to load it into a file first, then read the file.)

-SK


On 11/20/2012 1:00 PM, Porterfield, Sean wrote:

Is the part below why I get a bunch of spooled files when I run an
expect script? (Despite your numerous emails telling me not to do it
this way ;) )

First time using expect on i, so of course I just copied my previous
setup. Good time for me to improve and follow your recommendations.

Specifically, today is using Qp2RunPase from RPGLE rather than
QP2SHELL from CL, but your warnings applied to that previously.

--
Sean Porterfield


-----Original Message-----
From: Scott Klement
Sent: Monday, November 19, 2012 16:08
To: Midrange Systems Technical Discussion
Subject: Re: CALL QP2SHELL variables

Having said that -- I strongly discourage you from using QP2SHELL this way. QP2SHELL does not create proper stdio descriptors (stdin, stdout,
stderr) but rather uses whatever the calling job has set up. In this environment, that's either "nothing", or "the ILE C ones". Neither of these are threadsafe.


This email is confidential, intended only for the named recipient(s) above and may contain information that is privileged. If you have received this message in error or are not the named recipient(s), please notify the sender immediately and delete this email message from your computer as any and all unauthorized distribution or use of this message is strictly prohibited. Thank you.


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.