Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8619
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 ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us