Checking to see if this is possible with SORT/ICETOOL.
I have a file that has records in the following format.
HEAD MCNTRXX 0807200916301242 0000000001
HEAD CNTARXX 0807200916301242 0000000002010766100
10000085000A010766100
30 0003500001
70 14 GRABLES CIR
HEAD CNTBRXX 0807200916301242 000000000351800760873
10000085000A51800760873
30 0003500001
70 3 FENDER CT
HEAD CNTARXX 0807200916301242 0000000010010768900
10000085000A010768900
23 0003500001
73 56 JILLCREST RD
.
.
.
HEAD MCNTRXX 0807200916301242 0000000013
HEAD CNTARXX 0807200916301242 0000000002010766100
10000085000A010766100
30 0003500001
70 14 GRABLES CIR
HEAD CNTBRXX 0807200916301242 000000000351800760873
10000085000A51800760873
30 0003500001
70 3 FENDER CT
HEAD CNTARXX 0807200916301242 0000000010010768900
10000085000A010768900
23 0003500001
73 56 JILLCREST RD
.
.
.
HEAD MCNTRXX 0807200916301242 0000000013
The first record is the header of the file that needs to be skipped.
The second record is the header for the group.
So the records :
HEAD CNTARXX 0807200916301242 0000000002010766100
10000085000A010766100
30 0003500001
70 14 GRABLES CIR
are 1 set.
simiarly others.
The last record is the trailer of the file, with a count in it, that can be skipped.
The task here is to split the file into 2 files so that records with its header and set of records should be written to 1 file.. and other group to 2nd file.
Last record should be the trailer with the count of that file.
The first 12 bytes is the key - in this case "HEAD CNTARXX" and "HEAD CNTBRXX"
So the result should be :
File 1 :
HEAD CNTARXX 0807200916301242 0000000006010766100
10000085000A010766100
30 0003500001
70 14 GRABLES CIR
HEAD CNTARXX 0807200916301242 0000000010010768900
10000085000A010768900
23 0003500001
73 56 JILLCREST RD
HEAD CNTARXX 0807200916301242 0000000002
10000085000A010766100
30 0003500001
70 14 GRABLES CIR
HEAD CNTARXX 0807200916301242 0000000010010768900
10000085000A010768900
23 0003500001
73 56 JILLCREST RD
HEAD CNTARXX 0807200916301242 0000000002
File 2 :
HEAD CNTBRXX 0807200916301242 000000000351800760873
10000085000A51800760873
30 0003500001
70 3 FENDER CT
HEAD CNTBRXX 0807200916301242 0000000001
10000085000A51800760873
30 0003500001
70 3 FENDER CT
HEAD CNTBRXX 0807200916301242 0000000001
Hope I have drafted my question properly.
Let me know if anyone needs more clarification.
Thanks
Aka