IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 18, 2015 7:44 pm
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: 1249
Location: Richfield, MN, USA

PostPosted: Fri Dec 18, 2015 8:03 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Dec 18, 2015 10:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top