Posted: Tue Jul 15, 2014 8:28 pm Post subject: Fetch Records for a Particlar Quarter using Date
I have a requirement as follows
I have an input flat file which contains a Date in the format 'YYMMDD'. In the Record there is some additional information along with the date. The input file may contain dates corresponding to all months of a year.
I need to extract all the Data for a particular quarter.
That is the Dates corresponding to Jan-March, Apr-June, July-Sept, Oct-Dec
If i run my Job say on the 1st of April then only the dates that belong in the quarter of Jan-Mar(1st Jan 2014-31st March 2014) should be fetched. Similarly if i run my Job on 1st of July, only the dates corresponding to quarter Apr-June qualify.
To Summarize i need to check if a particular date falls within a quarter or not. The quarter that i am looking for will depend on the run date of my job. Example if run date is 4th April 2014 then the quarter Jan-Mar. Similarly if run date is 3rd Jan 2014 then the quarter Oct 2013 to Dec 2013 will qualify.
If The input flat file is as follows and i am looking for dates in the first quarter assuming the current date is 1st of April 2014(140401-the date on which i run my job)
Please let me know if this functionality can be achieved through a SYNCSORT/DFSORT.
any Help would be much appreciated.
The problem is need to use the system date to check for the quarter that i have to process because i do not know the Defined date for which i am checking the quarter. how can i do that using a sort card and eliminate the dates that do not Qualify.
I am using the system date because only that will help me identify the previous quarter which has to be selected. The job can be run any time of the year, i do not know beforehand which quarter we are interested in. For example if i run my job in Oct2014-then the Quarter Jul2014-Sept2014 qualifies, OR my job can be run on say Jan 2014 for which the Oct2013-Dec 2013 quarter will qualify.
I mean to say the quarter which has to be selected will be determined using system date. It will always be the quarter that comes before the system date.
For testing purposes alone, i plan to manually modify the date so that i can test for other quarters as well.
However, when the actual run will take place it will be according to the run date to fetch for previous quarter.
I have never used sort symbols, could you please show me an example where i can source the system date in YYMMDD format in a sort symbol. From there i believe, i will know the quarter to look for and subsequently can define a start date and end date for that quarter.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum