IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to extract the data for current year and previous year


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Venkata Ramayya

New User


Joined: 03 Dec 2007
Posts: 47
Location: United States

PostPosted: Thu Jan 05, 2023 10:20 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1650

PostPosted: Thu Jan 05, 2023 10:26 pm
Reply with quote

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
View user's profile Send private message
Venkata Ramayya

New User


Joined: 03 Dec 2007
Posts: 47
Location: United States

PostPosted: Thu Jan 05, 2023 11:14 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 1650

PostPosted: Thu Jan 05, 2023 11:24 pm
Reply with quote

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
View user's profile Send private message
Venkata Ramayya

New User


Joined: 03 Dec 2007
Posts: 47
Location: United States

PostPosted: Thu Jan 05, 2023 11:38 pm
Reply with quote

I thought someone would post an example here. Anyways, thanks for the document. I will take a look.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2963
Location: NYC,USA

PostPosted: Fri Jan 06, 2023 5:14 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 940
Location: Bamberg, Germany

PostPosted: Fri Jan 06, 2023 6:28 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2963
Location: NYC,USA

PostPosted: Sat Jan 07, 2023 2:50 am
Reply with quote

Agree with Joreg but can be done in a single step. This is how it can be used, just replace with your year.
ibmmainframes.com/about57873.html
Back to top
View user's profile Send private message
Joerg.Findeisen

Active Member


Joined: 15 Aug 2015
Posts: 940
Location: Bamberg, Germany

PostPosted: Mon Jan 09, 2023 1:01 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Extract record using 2 input file int... JCL & VSAM 2
No new posts Duplicate data in PUT CONTAINER using... CICS 4
No new posts Split a record with data in a differe... DFSORT/ICETOOL 8
No new posts data moved using MVI on para-name. PL/I & Assembler 4
No new posts Setting CA7 user variable from data s... CA Products 7
Search our Forums:

Back to Top