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

Remove OLD records from file based on date


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
trevor_rebelo

New User


Joined: 18 Aug 2005
Posts: 17

PostPosted: Tue May 15, 2007 6:08 pm
Reply with quote

Hi,

I have a req. in which i have to remove 6 yrs all records from a file.

i.e. Suppose first 10 characters is date in YYYY-MM-DD format (e.g 2006-10-31)

Now delete records which has date < current date - 6 yrs data.

Can we do current date - 6 yrs?

Trevor
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue May 15, 2007 6:41 pm
Reply with quote

That would depend on the sort product installed, and its PTF level, but let's face it, calculating a date of six years ago and coding it isn't going to be much of a task, is it.
Back to top
View user's profile Send private message
trevor_rebelo

New User


Joined: 18 Aug 2005
Posts: 17

PostPosted: Tue May 15, 2007 7:00 pm
Reply with quote

This job will run every month through scheduler and the everytime we needs to do the check.

Changing the Sort card in production every time is not easy..

Was looking for some generic way of doing it .... else we will have to write Pgm to do it.... around 1 billion records in file..... might need to omit 6M on every run.......
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue May 15, 2007 9:03 pm
Reply with quote

trevor,

Here's a DFSORT job that will do what you asked for. Just substitute the starting position of your input date field for p (e.g. 21) in the OMIT statement.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(DATE1(-))
  OUTREC BUILD=(C'TARGDATE,''',1,4,ZD,SUB,+6,EDIT=(TTTT),
    5,6,C'''',80:X)
/*
//S2  EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(p,10,CH,LT,TARGDATE)
/*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top