|
There are two ways that I know of to do this.
1) The opendir(), readdir(), etc APIs can be used to read through
a directory in a program. Then, you could write whatever
you wanted to any file that you wanted...
e.g. call opendir() with the directory you want to list,
then call readdir() in a loop. Write the results
directly in your XML format, or whatever you like.
2) You could use QSHELL to send the list to a file, and then you
could read that file in a program and reformat the data
into XML or whatever.
e.g. do a STRQSH CMD('cd /somedir/somewhere; ls>/path/to/outfile.txt')
then read /path/to/outfile.txt to generate your XML or what
ever you want to do.
Option #1 is a little more complicated, but doesn't require QShell to
be installed, and runs a lot quicker, eliminates the need for a temporary
file, etc.
Here's an RPG IV example from the archives:
http://archive.midrange.com/midrange-l/200201/msg00449.html
On Wed, 5 Jun 2002 JOberholtzer@compures.com wrote:
> Folks:
>
> I need to merge all the files that reside in a specific named IFS directory
> into one single file. The merged file can be in the IFS, or it can be
> DB/2, either will work. The data contained in these files is XML commands.
> I would use DSPLNK if the output went to an outfile, but I can't figure out
> how to get a list of the files to copy, or find a command that will use
> wild cards to accomplish the task. Any Ideas?
>
> Jim Oberholtzer
>
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.