Delete records .. or delete files?
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.