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: 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 Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

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