So - the "normal" ibm library system (qsys.lib) doesn't provide create date. Could do it based on modified date. As Jack said, I'd probably write a small shell script in bash. You could one line it with pipes, but I prefer the readability of small scripts. I did create a little one liner, but it failed on a weird permission error that I haven't seen before. I'll play around with it and see if I can't create an example for the archives when it slows down this afternoon.
On Tue, 2021-09-28 at 11:20 -0400, frank boke wrote:
Ok, how about the qsh version of the command? I use something like to
delete from the ifs;
STRQSH CMD('FIND /ARCHIVE -type f -mtime +30 -exec rm +
{} \;')
...but how would I delete the files using qsh based on either 30 days after
create date or files that were created on 9/2/21?
Again, much thanks for this.
On Tue, Sep 28, 2021 at 10:24 AM Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx<mailto:Kevin@xxxxxxxxxxxxxxxxxxx>>
wrote:
Personally I would use qsh or pase because I'm familiar with that. But if
you want to do it in sql, you could do it in two steps. A query like this
in RSS will give you a list of statements. You can copy the statements from
the results window up into the workspace, and then run all the statements.
SELECT 'drop table kevin.' concat trim(OBJNAME) concat ';' FROM
TABLE(QSYS2.OBJECT_STATISTICS('KEVIN', '*FILE'))
where date(objcreated) >= '2010-08-03';
That gave these results:
drop table kevin.AAMU;
drop table kevin.AATD;
drop table kevin.ASACHECK42;
drop table kevin.ASACHECK68;
drop table kevin.ASASMC24AL;
Which I cut and pasted up into the workspace, and ran them all with no
problems.
On Tue, 2021-09-28 at 09:55 -0400, frank boke wrote:
Hi Folks, is there any way to do this in sql?
I have files created on 9/2/21 in lib fbtemp and I want to use sql to
delete the files dated 9/2/21. How can I use sql to delete the files based
on the date or must I use qsh? I don't want to use cl if I don't have to
because it'd be easier using sql.
Thanks, Frank
[
https://www.medtronsoftware.com/img/MedtronMinilogo.bmp]
Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550<tel:985-893-2550>
Toll Free: 877-893-2550<tel:877-893-2550>
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain
confidential information, belonging to the sender that is legally
privileged. This information is intended only for the use of the
individual or entity named above. The authorized recipient of this
information is prohibited from disclosing this information to any other
party and is required to destroy the information after its stated need has
been fulfilled. If you are not the intended recipient, or the employee of
agent responsible to deliver it to the intended recipient, you are hereby
notified that any disclosure, copying, distribution or action taken in
reliance on the contents of these documents is STRICTLY PROHIBITED. If you
have received this email in error, please notify the sender immediately to
arrange for return or destruction of these documents.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link:
https://amazon.midrange.com
[
https://www.medtronsoftware.com/img/MedtronMinilogo.bmp]
Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550<tel:985-893-2550>
Toll Free: 877-893-2550<tel:877-893-2550>
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.
As an Amazon Associate we earn from qualifying purchases.