Complex sort logic
Posted: Sat Dec 10, 2016 5:33 pm
All,
I have a requirement which I googled and tried my best to solve. still I am in mid-way.
I have a input file with date field and two more packed decimal fields. Then I have to separate out records with date field GE to 01/01/2016.
In the output file I want all matching records and one more trailer record below with 4 fields.
1. Count of records matching date criteria
2. Sum of 1st packed decimal field
3. Sum of 2nd packed decimal field
4. (Sum of 1st field ×100)/sum of 2nd field.
What I have done as of now:
I have successfully created an output file with all matching records and one trailer record with first 3 fields.I am not able to calculate and populate 4th field in my output file using sort.
Can anyone please advise on this?
it would be a great help. Thanks for your assistance in advance.
Regards,
Manas
I have a requirement which I googled and tried my best to solve. still I am in mid-way.
I have a input file with date field and two more packed decimal fields. Then I have to separate out records with date field GE to 01/01/2016.
In the output file I want all matching records and one more trailer record below with 4 fields.
1. Count of records matching date criteria
2. Sum of 1st packed decimal field
3. Sum of 2nd packed decimal field
4. (Sum of 1st field ×100)/sum of 2nd field.
What I have done as of now:
I have successfully created an output file with all matching records and one trailer record with first 3 fields.I am not able to calculate and populate 4th field in my output file using sort.
Can anyone please advise on this?
it would be a great help. Thanks for your assistance in advance.
Regards,
Manas