On Tue, Apr 25, 2017 at 2:18 PM, Ron Thomas <ron5...@gmail.com> wrote:
> We finally decided to move the files to Z/OS unix , we plan to create a > monthly folder to which we push all the files from linux VM. Once the file > is there we will move back to GDG's . I have a query here , is there any > job which i can use to clean up the files in the z/os unix folder . Please > share if any one has the details on this . > With what criteria? I have my UNIX syslog daemon files going into the /var/log directory. Each day, a new file is generated (more on that later, if you're interested). I only want to keep the last 7 days. So, every day at 01:00 (a.m. local time), I have the cron daemon run the following command: find /var/log -mtime +7 | xargs rm -v # remove files more that 7 days old The stuff after the # is a comment since # is the shell's "begin comment" character, much like C/C++'s // You can run this using cron, as I do. Or you can set up a batch job which runs BPXBATCH do to the same thing and schedule it via something like CA-7. //RMFILES EXEC PGM=BPXBATCH,REGION=0M, // PARM='find /var/log -mtime +7 | xargs rm -v' //STDOUT DD SYSOUT=* //STDIN DD * /* //* Of course, you must run the job using a RACF id which has the appropriate UNIX authority to unlink (the proper UNIX term instead of "delete") the file. This could be "root" (bad idea), or the RACF id of the "owner" of the file(s), or a RACF id with the proper UNIXPRIV profile access, per https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.2.0/com.ibm.zos.v2r2.bpxb200/usspriv.htm If you want to copy each file to a separate GDG and delete it once that it done, it is more difficult because "cp" does not support creating a new GDG (+1) entry. There are "clever" ways to do it, but "clever" ways are often "rickety". > > Regards > Ron T > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- "Irrigation of the land with seawater desalinated by fusion power is ancient. It's called 'rain'." -- Michael McClary, in alt.fusion Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN