Joined: 22 Dec 2007 Posts: 126 Location: Bangalore
Hi,
I need your advice on what approach should I take (or if it is possible at all) to sort below type of recs.
Code:
Header1..............................................
01 NAME1 ADDRESS1 TA2222 S PHONE1
01 NAME2 ADDRESS2 TA2222 S PHONE2
01 NAME3 ADDRESS3 TA2222 S PHONE3
01 NAME4 ADDRESS4 TA2222 N PHONE4
01 NAME5 ADDRESS5 TA2222 S PHONE5
02 TA2222 <SUMMARY DETAILS OF ABOVE ROWS>
01 NAME1 ADDRESS1 TA1222 S PHONE1
01 NAME2 ADDRESS2 TA1222 N PHONE2
01 NAME3 ADDRESS3 TA1222 S PHONE3
01 NAME4 ADDRESS4 TA1222 N PHONE4
01 NAME5 ADDRESS5 TA1222 S PHONE5
02 TA1222 <SUMMARY DETAILS OF ABOVE ROWS>
01 NAME1 ADDRESS1 TA2223 S PHONE1
01 NAME2 ADDRESS2 TA2223 S PHONE2
01 NAME3 ADDRESS3 TA2223 S PHONE3
01 NAME4 ADDRESS4 TA2223 S PHONE4
01 NAME5 ADDRESS5 TA2223 N PHONE5
02 TA2223 <SUMMARY DETAILS OF ABOVE ROWS>
03 <WEEKLY SUMMARY DETAILS>
04 <MONTHLY SUMMARY DETAILS>
For ease of programming I want to SORT the above given recs. Now the first line is header and last 2 are trailers. How I need to sort is, post sort the data should look like below..
Code:
Header1..............................................
01 NAME1 ADDRESS1 TA2222 S PHONE1
01 NAME2 ADDRESS2 TA2222 S PHONE2
01 NAME3 ADDRESS3 TA2222 S PHONE3
01 NAME5 ADDRESS5 TA2222 S PHONE5
01 NAME4 ADDRESS4 TA2222 N PHONE4
02 TA2222 <SUMMARY DETAILS OF ABOVE ROWS>
01 NAME1 ADDRESS1 TA1222 S PHONE1
01 NAME3 ADDRESS3 TA1222 S PHONE3
01 NAME5 ADDRESS5 TA1222 S PHONE5
01 NAME2 ADDRESS2 TA1222 N PHONE2
01 NAME4 ADDRESS4 TA1222 N PHONE4
02 TA1222 <SUMMARY DETAILS OF ABOVE ROWS>
01 NAME1 ADDRESS1 TA2223 S PHONE1
01 NAME2 ADDRESS2 TA2223 S PHONE2
01 NAME3 ADDRESS3 TA2223 S PHONE3
01 NAME4 ADDRESS4 TA2223 S PHONE4
01 NAME5 ADDRESS5 TA2223 N PHONE5
02 TA2223 <SUMMARY DETAILS OF ABOVE ROWS>
03 <WEEKLY SUMMARY DETAILS>
04 <MONTHLY SUMMARY DETAILS>
Means Header and 2 trailers should be in tact. Our 02 rec should be in tact. Sort will happen only on the TA number (Transfer Agent) against BILL (Either S or N).
What I can remember using DATASORT I can keep my Header and Trailer in tact and sort in between but I am not getting how to keep 02 rec in it's place and do the sort.
Can anyone please guide me?
Joined: 22 Dec 2007 Posts: 126 Location: Bangalore
Hi Joerg,
First of all thanks! a lot for your reply. Yes it is working correctly. At the same time I was also trying to fix this issue and I used DATASORT in ICETOOL to achieve the same result. Which I will post here. Then atleast we will have 2 solutions...
Joined: 15 Aug 2015 Posts: 1255 Location: Bamberg, Germany
I try to avoid the overhead of ICETOOL because nearly everything can be done with ICEMAN as well. As I see, DATASORT has a fixed number of Header- and Trailer lines. My last solution allows flexible numbers (so far that's tested).