View previous topic :: View next topic
|
Author |
Message |
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
Hi,
I want to exclude the records which are more than 5 years old.
The problem is, i can't give the specific year.
It should run for each year automatically.
Is there any way to do it?
regards,
sharad |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
sorry to bother you again?
the constraint is, i need to do it thru SORT?
please advice.
-
sharad |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
sharad,
How do you identify the record which is more than 5 years old? Do you have nay field for this, what is the date format? |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
yes!...
we have a certain field for them.
say it starts with cloumn 5 and ends with cloumn 8. ie. total length is 4. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
What is this col 5 to 8 looks like.
Anyway with some assumption Im posting this:
In the SORT omit condition you can use date function with relative -5 to years. |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
please explain it a bit more. |
|
Back to top |
|
|
Devzee
Active Member
Joined: 20 Jan 2007 Posts: 684 Location: Hollywood
|
|
|
|
Quote: |
say it starts with cloumn 5 and ends with cloumn 8. ie. total length is 4. |
what data is in this field? |
|
Back to top |
|
|
sharad_shanu
New User
Joined: 03 Oct 2006 Posts: 40
|
|
|
|
it looks like
$$$$2007
where $ represent any character?
now i want that only 2007 - 2003 should be included?
i hope it is more of a clear now. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
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
* Create DFSORT Symbol as follows:
* Year,'yyyy'
* where yyyy is current year - 4
INREC OVERLAY=(21:DATE2,
1:C'Year,''',21,4,ZD,SUB,+4,EDIT=(TTTT),C'''',21:60X)
/*
//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
* Use Year symbol in INCLUDE statement
INCLUDE COND=(5,4,CH,GE,Year)
/*
|
|
|
Back to top |
|
|
|