I have 2 Queries Please reply to same.
1. I have a file having LRECL = 100, RECFM = FB. There are 2 Date Fields (Date1 & Date2). Need to Calculate the Date Difference (Date2 - Date1). Output File to have all records from Input File along with Date Difference. Both Dates is in format YYYY-MM-DD (2015-03-08).
2. Output file generated (file having Date Difference), need to be Sortd in a Way that If the Difference between 2 Date is Same where Date1 is same then both records need to be written to the Output file. Below is an Example. Here Need to SORT on the basis of Start Positon = 1, End Psition = 20. Output File Should not have Date Difference Field. O/P file to hve LRECL = 100
ABCD|1234|2015-03-10|2015-03-17|XYZ|8 ---> Date1 = 2015-03-10, Date2 = 2015-03-17, Date Difference = 8, SORT CRITERIA = ABCD|1234|2015-03-10 --> Written to output File
ABCD|1234|2015-03-10|2015-03-17|XYZ|8 ---> Date1 = 2015-03-10, Date2 = 2015-03-17, Date Difference = 8, SORT CRITERIA = ABCD|1234|2015-03-10 --> Written to output File
EFGH|2345|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = EFGH|2345|2015-03-21 --> Written to output File
IJKL |7890|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = IJKL |7890|2015-03-21 --> Written to output File
MNOP|8888|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = MNOP|8888|2015-03-26 --> Written to output File
MNOP|8888|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = MNOP|8888|2015-03-26 --> Written to output File
MNOP|8888|2015-03-21|2015-03-30|KKK|10 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 10, SORT CRITERIA = MNOP|8888|2015-03-30 --> Should NOT Get Written to File.
ABCD|1234|2015-03-10|2015-03-17|XYZ|8 ---> Date1 = 2015-03-10, Date2 = 2015-03-17, Date Difference = 8, SORT CRITERIA = ABCD|1234|2015-03-10 --> Written to output File
EFGH|2345|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = EFGH|2345|2015-03-21 --> Written to output File
IJKL |7890|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = IJKL |7890|2015-03-21 --> Written to output File
MNOP|8888|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = MNOP|8888|2015-03-26 --> Written to output File
MNOP|8888|2015-03-21|2015-03-26|KKK|6 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 6, SORT CRITERIA = MNOP|8888|2015-03-26 --> Written to output File
MNOP|8888|2015-03-21|2015-03-30|KKK|10 ---> Date1 = 2015-03-21, Date2 = 2015-03-26, Date Difference = 10, SORT CRITERIA = MNOP|8888|2015-03-30 --> Should NOT Get Written to File.
Thanks
Kin Rgd's
Code'd