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



Scott,

At present I call a CL with an ovrdbf of stdout to a qtemp file and then
QSH.

The QCMDEXC could achieve more or less the same result; it's a setup step
and I'm not concerned with high performances.

However I was curious on how to use QzshSystem (just to let easy things to
become more difficult and obscure).  I saw some old postings but it was not
so clear.

Thanks for your explanation.

Giuseppe.

----- Original Message ----- 
From: "Scott Klement" <rpg400-l@xxxxxxxxxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, February 22, 2005 6:24 PM
Subject: Re: Create a directory from RPG


>
> > Within CL it works fine using:
> > QSH CMD('mkdir -p /one/two/three/four')
>
> So why not do it that way in RPG as well?  (via QCMDEXC, system(), etc)
> You'll get rotten performance, but that's no different from CL.
>
>
> > I've tried QzshSystem from Rpg but I always get error 7. I've checked
> > old postings but I did not understand the right way to code.
>
> The way that QShell works is that it spawns a separate job for each
> command that you run. That job is connected to the original job via 3
> pipes.  One for standard input, one for standard output and one for
> standard error. (That's why QShell commands seem so slow -- for each one
> it has to create a new job and connect the pipes!)
>
> The QzshSystem() API does NOT create the background job or the pipes for
> you. You have to do that yourself -- making this API almost completely
> useless! (In my opinion.)
>
> You can use the spawn() or spawnp() APIs to run a QShell command. If you
> use the pipe() API to create the pipes, you can have a functioning QShell
> command this way.
>
> A much better (more efficient) way to create these directories is to use
> the mkdir() API instead of trying to call QShell.  mkdir() doesn't have
> the option to automatically create the parent directories, but that's not
> very difficult to do with a simple %scan() loop in RPG.
>
> Just wrap the routine up in a subprocedure and stick it into a service
> program, then you'll always have it!
> -- 
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>


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.