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




I need to dump some files into a folder on the IFS and then use a
CPYFRMPCD to a file on the 400, first being a replace and subsequent being
adds.

Yuck. Dump CPYFRMPCD and use CPYFRMSTMF or CPYFRMIMPF. Or better yet, just read the IFS files directly and skip copying it to a database altogether.


The problem with CPYFRMPCD is that it only works in the old-fashioned, MS-DOS circa 1989 compatible /QDLS filesystem. If you aren't going to join the 21st century, at least upgrade to 1990s technology! :)


And of course I'd like to automate it.  =)  Is there any way I can
use an RPG or CL to read the contents of the folder and then do the copy
commands automatically?  Thanks in advance.

Sure. In CL, you'd probably call a QShell command to dump the filenames in the directory to a physical file. Then, you'd read the PF to get each filename and process it.


Here's an article that I wrote that demonstrates the QShell technique from a CL program:
http://www.iseriesnetwork.com/article.cfm?ID=18499


In RPG, you might also use the QShell method, either by using the QCMDEXC API to run the STRQSH command, or by directly accessing the QShell command using spawn() and pipe() or by piping the input to your RPG program. (Whew, that's a lot of options!) Info about pipes and spawn() can be found in the following article:
http://www.iseriesnetwork.com/article.cfm?ID=19095


Finally, the fastest way is to use the IFS APIs. I've got a tutorial on that subject on my web site, an an article in iSeries NEWS magazine that's slated for June.

The IFS info on my Web site can be found at the following link:
http://www.scottklement.com/rpg/ifs.html

In particular, you'll want to look at Chapter 7 for info on reading a directory. The rest of the e-book will also be helpful if you want to read the files directly instead of resorting to CPYFRMxxx commands.

Good Luck

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.