I want to automate the process of deleting a file in a LAN Folder based on Creation Date. Eg: Extract in text format will be sent to C: on a daily basis. Then Extract will get deleted after 7th Day of Creation Date. I want to achieve this in AS/400 and automate this entire process. Please help me to delete the files based on creation date.
Extract in txt format will be sent to C: on daily basis.
.
What is "C:"? It looks like a drive specification for Windows.
.
It might also help if you put something a little more descriptive than just "AS400" for your question titles. Using the same title as dozens of other questions can make yours harder to recognize in a list. Something like "How to delete documents by date" would be much better.
It is possible to delete by "creation date", but it's not simple. Most UNIX manipulation or aging uses "last change date & time", and very little is usually possible based on "create date".
.
If the file is stored in a directory in your AS/400's /root file system, an actual "create date & time" can be retrieved from the file's attributes. The Qp0lGetAttr() (Get Attributes) API can return a time value that you can compare to a time value that you generate. The comparison can tell you if the file should be removed or not.
.
I don't know how reliable the "create date & time" attribute will be for any remote file system such as /QNTC.
.
If the "last change" time value is sufficient, then a fairly easy QShell script is all that's needed. The find utility can be used to select old files, pretty much the same as any UNIX or Linux shell script would get it done.
.
But no matter what, your reference to "C:" needs to be explained.
Hi All,
I have created .VBS (VB Script) to delete the Files which is located in Hard Disk. VB Script will delete the Files based on the creation date. I have tested this script. Its working as expected. Shall i use STRPCCMD to run this script from AS400. Is it possible?
You could use STRPCCMD as long as you have an active emulator session that can run the STRPCCMD command. If you can't use an active emulator session, then you can use RUNRMTCMD or the rexec() API or other remote execution functions. It'd be easier not to use VB and simply do it all on your server.-- Tom
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!
Discuss This Question: 4  Replies