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




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!

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.