Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Write a job to delete the files aging for more than 10 days

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Abhinav Roy

New User


Joined: 07 Dec 2015
Posts: 2
Location: netherlands

PostPosted: Fri Dec 18, 2015 7:17 pm    Post subject: Write a job to delete the files aging for more than 10 days
Reply with quote

Hi All,

I have a requirement to delete Mainframe files (aging for more than 10 days) from an archive location. Can any one of you please help me here.

How to identify whether the file is aging for more than 10 days ?

I am ready with the following piece. Question is how to make it complete it in terms of mentioning the archive path and how to identify the number of days for which it is aging.

A response from any one of you and I will be extremely thankful to you.

//DELETE EXEC PGM=IEFBR14
//DD1 DSN=TEST.DATA1,DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(0))
//DD2 DSN=TEST.DATA2,DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(0))
//DD3 DSN=TEST.DATA3,DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(0))
//DD4 DSN=TEST.DATA4,DISP=(MOD,DELETE,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(0))
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Dec 18, 2015 7:44 pm    Post subject:
Reply with quote

Terminology is critical since similar terms in IT may mean very different things. When you say "archive path" you are implying a Unix System Services directory since z/OS does NOT have any paths (at least, not for data sets; coupling facilities are a different story but they wouldn't need to be deleted the way you're talking about). And Unix System Services has files whereas z/OS has data sets (files do not necessarily have a record structure whereas data sets are record-based).

If you ARE talking about a Unix System Services directory, investigate the use of skulker. If you are NOT talking about a Unix System Services directory, you have not provided nearly enough information for any answers to make sense. For example,:
- Is data set aging based on create date, last referenced date, or what?
- Using IEFBR14 is probably the worst possible way to delete the data sets.
- Does your site not use HSM for storage management? If so, why are you even bothering with this?
- What is doing the archiving? Could that be used to delete "old" data sets as well?
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Fri Dec 18, 2015 8:03 pm    Post subject:
Reply with quote

Abhinav Roy,
Please use Code tags for readability of code, JCL, etc. Example:
Code:
//DELETE EXEC PGM=IEFBR14
 //DD1 DSN=TEST.DATA1,DISP=(MOD,DELETE,DELETE),
 // UNIT=SYSDA,SPACE=(CYL,(0))
 //DD2 DSN=TEST.DATA2,DISP=(MOD,DELETE,DELETE),
 // UNIT=SYSDA,SPACE=(CYL,(0))
 //DD3 DSN=TEST.DATA3,DISP=(MOD,DELETE,DELETE),
 // UNIT=SYSDA,SPACE=(CYL,(0))
 //DD4 DSN=TEST.DATA4,DISP=(MOD,DELETE,DELETE),
 // UNIT=SYSDA,SPACE=(CYL,(0))
Back to top
View user's profile Send private message
Abhinav Roy

New User


Joined: 07 Dec 2015
Posts: 2
Location: netherlands

PostPosted: Fri Dec 18, 2015 8:51 pm    Post subject: Reply to: Write a job to delete the files aging for more than 10 days
Reply with quote

Thanks Robert for your reply.

Yes, it is a Unix System Services directory.

Solution is to do a change directory to any directory one wants to clean, find the files older than 10 days, and delete them

Question is how to execute the The cd (change directory) command in batch ? Any idea ? I will be extremely thankful to you for your response.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Dec 18, 2015 10:50 pm    Post subject:
Reply with quote

You are not clear -- is there a single archive directory that you know in advance, or are you wanting to remove files of a certain age from any directory? For the former, use skulker in a cron task once a day (cron will allow you to schedule the task when the impact to the system will be minimal). If the latter, you'll need to manually run skulker on the directory. From the Unix System Services Command Reference manual:
Quote:
skulker [–iw][–r|–R] | [–l logfile ] directory days_old
Description

z/OS V1R12.0 UNIX System Services Command Reference
SA22-7802-13

|skulker finds files that are candidates for |deletion in directory, based on comparing the file's |access time to the age specified by days_old.

|When you call skulker without any options, |the files that are candidates for deletion are regular files found |using the primaries as shown in the following find command |line:
|

find directory -type f -atime +days_old -level 0 ! -name "*'*" ! -name "*
|*" -print

The preceding find command has a deliberate |newline inserted as part of the second -name request.

For example, specifying 5 for days_old causes the find command to find files that are equal to or older than five 24-hour intervals earlier than now.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us