I have a 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 should be fetched. Similarly if i run my Job on 1st of July, only the dates corresponding to quarter Apr-June qualify.
To Summarise i need the dates three months prior to the current date. I also need to take into consideration leap year condition if it does arise for a particular year.
Example:
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)
140224
140423
140903
140105
140809
140331
140423
140903
140105
140809
140331
My output should be
140224
140105
140331
140105
140331
I have tried using “DATEDIFF”, “SUBMONS” and used it with Y2T for the 'YYMMDD' format. However i get a “Syntax Error” when i try to do so. I have tried many variations of the sort card using DTNS for conversion but am unable to get past the Syntax error.
Example Sort Card i Used :-
//SYSIN DD *
OPTION COPY
OUTREC BUILD=(1:1,6,Y2T,SUBMONS,+3,Y2T)
/*
OPTION COPY
OUTREC BUILD=(1:1,6,Y2T,SUBMONS,+3,Y2T)
/*
I received a syntax error for the same with an '*' placed on the SUBMONS. Similarly when i used DATEDIFF i receive the same error.
FYI:
I am using SYNCSORT: Version 1.4.1
Please let me know if there is any other method other than using DATEDIFF or SUBMONS to fulfill my requirement using DFSORT/SYNCSORT.
Any Help would be deeply appreciated.
Thank You,
Healy