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
 

 

Remove OLD records from file based on date

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Remove OLD records from file based on date
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: 8593
Location: Back in jolly old England

PostPosted: Tue May 15, 2007 6:41 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue May 15, 2007 9:03 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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