
PGM DCLF QSYS2/SYSTABLES loop: RTVF MONMSG .... GOTO ENDPGM IF %SST(TABLE_SCHEMA = 'QS36F') DO IF %SST(TABLE_NAME, 1, 4) = 'ABC.' AND + %SST(TABLE_NAME, 7, 1) = 'X' + THEN(DLTF QS36F/TABLE_NAME)) ENDDO GOTO loop endpgm: ENDPGM2. Another approach could be to use SQL. My proposed pseudo-code:
SELECT TABLE_NAME, TABLE_SCHEMA FROM QSYS2/SYSTABLES WHERE TABLE_NAME = 'QS36F' AND SUBSTR(TABLE_NAME 1 4) = 'ABC.' AND SUBSTR(TABLE_NAME 7 1) = 'X' ....followed by DROP TABLE QS36F/TABLE_NAMEHow can this be put together into a batch-program ? 3. Use QSHELL Can this be used at all in a non-IFS environmen? We like the thought of using the SELECT and PIPE functionality of QSHELL. Any comments and thoughts on this task are most welcome. DanF


...a non-IFS environmen?
If it runs on an AS/400 at V3R1 or later, it is running in an IFS environment. The IFS includes all file systems.
For a library named QS36F with a file named ABC.aaXb, the name of that file in IFS format is [/QSYS.LIB/QS36F.LIB/ABC.aaXb.FILE]. The use of a .dot (".") in the middle of a file name is messy, but it shouldn't be a problem.
A Qshell utility such as the find - Find files utility could help. For example, try this in QSH:
find /qsys.lib/qs36f.lib -name 'ABC.??X?.FILE' -type d
The example pattern is ['ABC.??X?.FILE']. Note that it is case-sensitive in this example.
And note that I used [-type d] to limit the results only to include "directories". That's because an IFS reference to a database *FILE object is handled as a directory access. The "files" in a *FILE directory are its members, each of which will have the .MBR extension as part of its name. That is, a "directory" named [/qsys.lib/qs36f.lib/ABC.aaXb.FILE] will probably have at least one "file" in it named [/qsys.lib/qs36f.lib/ABC.aaXb.FILE/ABC.aaXb.MBR].
When you feel comfortable with what the above Qshell command does, review the possibilities from:
find /qsys.lib/qs36f.lib -name 'ABC.??X?.FILE' -type d -exec rm -R {} ;
The -exec option says to execute a rm utility for each time find gets a match. The rm -R option says to process a directory recursively, which means members are removed before the file is removed. (Generally you can't delete a 'directory' if it's not empty.) The braces get replaced by whatever name that find supplies. The semi-colon is needed to terminate the -exec option which might be complex. The back-slash will be needed as an escape character if you run the command in the shell because the shell will want to process the semi-colon according to its rules.
That should be enough to let you experiment for a while.
Tom
<a href=”http://www.louboutinshoecheap.com/”>Christian Louboutin Shoes</a> are great to wear during warmer weather because they help keep your feet cool. <a href=”http://www.louboutinshoecheap.com/”>Cheap Louboutin Pumps</a> are an open type of outdoor footwear, consisting of a sole held to the wearer’s foot by straps or thongs passing over the instep and around the ankle. Wedge white <a href=”http://www.louboutinshoecheap.com/”>Discount Christian Louboutin Sale</a> are also suitable for shopping because they are so comfortable to walk around in. Among the advantages of wedge sandals are that these <a href=”http://www.louboutinshoecheap.com/”>Cheap Louboutin Shoe</a> add height, but are easier to walk in than stilettos, and that a wedge heel looks great with nearly any <a href=”http://www.louboutinshoecheap.com/christian-louboutin-pumps/”>Christian Louboutin Pumps</a>. They look good with almost anything – from jeans to flowy skirts. The color white ensures that the pair of <a href=”http://www.louboutinshoecheap.com/christian-louboutin-evening/”>Christian Louboutin Evening</a> can be matched with anything. <a href=”http://www.louboutinshoecheap.com/”>http://www.louboutinshoecheap.com/</a>


Thanks Tom,
As always very informative information from you. I’ll test (and implement!) over the weekend, and then report back to this thread.
DanF
I now found a working soluion:
QSH CMD('find QSYS.LIB/QS36F.LIB -name "ABC.??X1.FILE" -type d | xargs rm -R ;')One very essential finding from my experimentations: Make sure that your rootpath is ” .
Thanks again
DanF
Make sure that your rootpath is…
The rootpath should only be relevant if you use a ‘relative’ path. If an ‘absolute’ path is used, i.e., a path beginning with a slash, the rootpath shouldn’t affect processing. See Path name for basic discussion.
Tom
Thanks again Tom,
I tested the command after having added a slash to the filename-string, and voila, it now works 100% as wanted.
The modified command in its full comes here:
QSH CMD('find /QSYS.LIB/QS36F.LIB -name "ABC.??X2.FILE" -type d | xargs rm -R ;')DanF
Hmmm… the timing of your reply makes me think “DanTheDane” refers to location if not heritage. You’re welcome.
Tom