×
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.
At 09:26 PM 8/14/2003, Andre Manriquez wrote:
1. Is there a way to tell the AS/400 copy all files, *all perhaps, within
a given directory to a file/lib/mbr?...perhaps to a lib only instead of to
a specific file and create the files dynamically based on names in the IFS?
2. Thru a CL program is there a way to do something like read out all
file names within a directory and call the CPYFRMSTMF cmd for each file name??
I'm looking to automate these steps thru a CL and OS/400 scheduler. Any
thoughts or insight would be greatly appreciated.
There are APIs that would probably (I haven't need to do it yet) allow you
to get a list of all the files in an IFS folder, but they're a bit much for
CL. You could also use a shell script. It's easy:
Files = "`ls Foldername`"
for File in ${Files}; do
# do your stuff here -- maybe pipe the names to a file in qsys.lib
# and call a CLP. Maybe just execute CPYFRMSTMF directly.
rm -f $File # -- Don't do this if the copy is run asynchronously use
DLTDLO instead?
done
Or,
You could do it with a .bat or .cmd file (if you're on a PC):
if Exists aNameList.dat goto test2
goto run
test2:
if Exists Running.mkr goto conflict
if Exists ListDone.mkr goto rmlist
goto run
rmlist:
del ListDone.mkr
run:
For %%A in (X:\Foldername\*.txt) Do Echo %%A > aNameList.dat
echo Namelist build succeeded
goto done
conflict:
echo Process is running. Can't do it now
done:
Periodically, a job on the AS400 executes, creates the Running.mkr file
(with CPYTOSTMF?) and tries to CPYFRMSTMF the aNameList.dat file to a file
in qsys.lib, monitoring for a file not found condition. If it succeeds, it
opens the file and performs the required processing, including removing
processed files. If the file doesn't exist, it quits. Either way it deletes
the Running.mkr file (with DLTDLO?). There may be some potential for
trouble here if the cmd file is executing when the AS400 job is active. The
marker file logic needs a little work. That's the general idea though.
HTH
Pete Hall
pbhall@xxxxxxxxxxxxx
http://www.pbhall.us/
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.