Joined: 18 Mar 2007 Posts: 44 Location: New Jersey,USA
Hi ,
Is There any method to determine the Previous Month Range in Sort ,
ie , i need to obtain the Records from my input file whose transactions were posted in the last one month alone...
Ex..
If Current RUn date is 07-August 2008
Then i should extract records with dates for the previous month which is 01-July-2008 to 31-july-2008 and not as 07-july-2208 till current date!!!
similarly if current run date is March , then i should extract records for the Feb Month..which means 01-02-2008 to 29-02-2008...
All this Dynamically...
More importantly is knowing the Range od the previuos month rather than the day in the previous month....
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
VIGNRSH,
The following DFSORT JCL will give you the desired results. I assumed that your input is FB and 80 bytes in length. I assumed that your input is DD-MM-CCYY format.
Using INREC we add last month first date using Date2-1 (ccyymmdd) and current date(ccyymmdd) using Date1 and reformat the input file date to CCYYMMDD and now using an include cond on outfil we pick the date range records