I have a Transaction Data file with 5 million records. And the key information of the file is as follows.
It holds the data for a calendar month and the data gets appended every day mid-night
LRECL = 9855
RECFM=VB
DATE field starts at position 3. And it looks like 'YYYYMMDD'.
For Example, Transaction Data file for November 2015 has the records starting from 1/Nov/2015 till today. latest data is at the bottom of the file.
I have 2 scenarios here.
One is to extract the data from the input-file (5 million records) for a specific date, mostly yesterday (1 day before current day)
I use the following code
SORT FIELDS=COPY
INCLUDE COND=(7,8,CH,EQ,C'20151123')
INCLUDE COND=(7,8,CH,EQ,C'20151123')
Second is to extract the data from the input-file (5 million records) starting from a specific date.
I use the following piece of code
SORT FIELDS=COPY
INCLUDE COND=(7,8,CH,EQ,C'20151116',OR,
7,8,CH,EQ,C'20151117',OR,
7,8,CH,EQ,C'20151118',OR,
7,8,CH,EQ,C'20151119',OR,
7,8,CH,EQ,C'20151120',OR,
7,8,CH,EQ,C'20151123')
INCLUDE COND=(7,8,CH,EQ,C'20151116',OR,
7,8,CH,EQ,C'20151117',OR,
7,8,CH,EQ,C'20151118',OR,
7,8,CH,EQ,C'20151119',OR,
7,8,CH,EQ,C'20151120',OR,
7,8,CH,EQ,C'20151123')
Query: Above piece of codes are working fine to my requirement. But these are processing 4.8 million records just to extract 20,000 records unnecessarily. Is there a better way of doing it.