View previous topic :: View next topic
|
Author |
Message |
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 47 Location: United States
|
|
|
|
Hello,
I have a year the in the input file. I have to extract data for current year and previous year only using sort card. Please help
Thanks
Venkat |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 1751
|
|
|
|
Venkata Ramayya wrote: |
Hello,
I have a year the in the input file. I have to extract data for current year and previous year only using sort card. Please help
Thanks
Venkat |
So far, what did you try, and what prevents you from getting any (maybe wrong) result?
Did you try this, for example?
Code: |
INCLUDE COND=(select-only-required-years) |
|
|
Back to top |
|
 |
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 47 Location: United States
|
|
|
|
No I have not tried anything. Year is not static value in this case. It will keep changing every year. I think I need to use some date function in the sort card. I need help on that. Thanks |
|
Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 1751
|
|
|
|
Venkata Ramayya wrote: |
No I have not tried anything. Year is not static value in this case. It will keep changing every year. I think I need to use some date function in the sort card. I need help on that. Thanks |
Please, RTFM. DFSORT Application Programming Guide
Everything is explained in details, with multiple examples.
Try at least something; then you may ask for help.
Good luck! |
|
Back to top |
|
 |
Venkata Ramayya
New User
Joined: 03 Dec 2007 Posts: 47 Location: United States
|
|
|
|
I thought someone would post an example here. Anyways, thanks for the document. I will take a look. |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 2992 Location: NYC,USA
|
|
|
|
Cleaned up and let us adhere to the forum rules.
You need to show us sample data and expected output for anyone here to help you. I restate to search this forum for having many examples of how to filter on dates in include condition.
Try it . |
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1023 Location: Bamberg, Germany
|
|
|
|
You could use DATE<n> and DATEDIFF to build symbolics in a first step. In the next step compare against the freshly created SYMNAMES. This is not much lines of code. |
|
Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 2992 Location: NYC,USA
|
|
Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1023 Location: Bamberg, Germany
|
|
|
|
Minor mistake by me, but the solution is on the same page in DFSORT manual as DATEDIFF. Obviously it should be SUBYEARS keyword (as I have used in my test case). |
|
Back to top |
|
 |
|