Automate deletion of files based on creation date in AS/400

1215 pts.
Tags:
AS/400
as/400 files
LAN
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.

Answer Wiki

Thanks. We'll let you know when a new response is added.

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?

 

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    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.
    .
    Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    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.
    .
    Tom
    125,585 pointsBadges:
    report
  • rajeshece
    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?
    1,215 pointsBadges:
    report
  • TomLiotta
    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
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following