Deleting IFS records after so many days

135 pts.
Tags:
AS/400
CL Commands
IFS
Can anyone provide CL code that would delete records within a date range? I would like to delete entries, say-that are 35 days old from the IFS.

Software/Hardware used:
as400 v6r1

Answer Wiki

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

Discuss This Question: 2  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
  • philpl1jb
    Delete records .. or delete files?
    49,550 pointsBadges:
    report
  • TomLiotta
    Yeah, clarification on deleting "records" would be useful. It'd also be helpful to know why CL was requested. CL wouldn't usually be the first language choice for processing IFS files by date (nor most other ways). It can certainly be done. I've done similar things in three different ways with CL. The most common and simplest way is by using Qshell utilities. The 'find' utility can form the basis of a function that returns IFS files within a chosen path that are older than your set age. If you wanted more detailed control, the Integrated File System APIs [ http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Funix2.htm ] include opendir(), readdir() and closedir(). You could code a CL procedure to retrieve entries and check dates. Or Qp0lProcessSubtree() is another Integrated File System API that could be more efficient than the other two possiilities. Either way with APIs can require fairly detailed knowledge of how to interpret attributes of directory entries. Coding can be fairly complex depending on the directory structure, the CCSID of names, the conversion of date values and other elements. The Qshell alternative would likely be much simpler to code. It probably would also run much slower. If the volume of entries is high, it might be too slow. It's pretty easy to practice with the utilities, though. You can work out the command you need interactively. You can use [ qshell delete age ] as a Google search to find a number of articles. Some of the problems with creating and running such a function are mentioned in different articles. You'll have to determine what issues you'll run into, if any. 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