|
Hello,
Ok, I'm getting further along thanks to you folks; find fbtest/* -name '*' > /fbtest/authinfo
Consider changing this command to the following: find /fbtest > /fbtest/authinfoThe way you coded it, the "find" program is being passed the name of every file in the directory, and that's not necessary, since "find" will automatically recurse into subdirectories.
If you have a small number of files in the directory, it won't matter. The results will be the same. But omitting the wildcard will prevent errors when you have a lot of files in the directory.
You'll also not ethat I added a leading slash to the "fbtest" directory name. You had "fbtest/*" and I changed it to "/fbtest". The slash tells QShell to start with the root directory. In other words, it'll open the fbtest directory that's located in the root directory of the IFS. Your method (omitting the slash) tells it to start with your current directtory and move forward.
For example, if you type: cd /qibm find fbtest > outfile.txtit'll list all of the files in the /qibm/fbtest directory. By contrast, if you type:
cd /qibm find /fbtest > outfile.txtIt won't matter that you just used the "cd" command to change your current directory, it'll always look at the fbtest directory that's located on the root directory.
This is important when you're writing a script or program, because the current directory is intended to be something that's changed by the user. If you don't include the leading slash, your program might work for some users but not other users, or it might work today and stop working tomorrow when the system configuration changes. Including the leading slash will save you headaches down the road.
I also removed " -name '*' " from your find command because it's not necesary. The "find" utility lists all names by default.
If you intend to use this from a CL program, then I suggest NOT directing the output to a file. Instead, I suggest directing the output to STDOUT (the default) and let the CL program handle the re-direction with an OVRDBF command. For example:
PGM CRTPF QTEMP/MYFILE RCDLEN(1000) OVRDBF FILE(STDOUT) TOFILE(QTEMP/MYFILE) STRQSH CMD('find /fbtest') DLTOVR FILE(STDOUT) ENDPGMThe main reason I prefer that technique is that QShell can't use the QTEMP library. Since QTEMP adds lots of value (IMHO) to the process, it's nicer to let the CL program do it, since it *can* direct the output to QTEMP.
At this point, MYFILE contains a list of the filenames in the /fbtest directory. You can read that file, and for each filename, execute the DSPAUT command to display the authority.
(If that's what you were looking for?)Alternately, you could display the authority settings directly (in Unix format) using the -ls switch to the find command. For example:
STRQSH CMD('find /fbtest -ls')But bear in mind that it'll show them in a Unix format, and that might not be intuitive to your users who are used to iSeries authorities. Plus, it doesn't show everything, since the iSeries is capable of lots of authority settings that Unix is not, and "find" only knows abut the Unix stuff.
So DSPAUT might be a better alternative. HTH
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.