Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
sqlcode,
I've been trying to make this easy to do :-)
Why don't you like "identify the data lines/leave everything else alone"? Positions, content, artistic style of everything except the data lines becomes irrelevant. Copy 'em out. Sort 'em. Stick 'em back where a data-line was originally.
I've even been thinking I could code it, using enrico's duplicate-matching code.
Bill Woodger,
The logic here in the code I gave, identifies HEADER records and populate sort key values in such a way so that HEADER records are kept together and at the top for every group starting with given HEADER conditions.
Sure, we may approach "identify the data lines/leave everything else alone", but unless, I am missing some of OP's remarks here, I don't see a way to identify "detail" records.
One way to achieve the same would be to use below conditions,which checks for "NUM"erics on 25th position,but I am not sure if that will suffice OP's requirement. This would fail if one of the header conditions has numbers at 25th position.
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
I think the issue may have been resolved earlier if there had been sample output to go with the sample input - then we could have seen if data lines changed pages or not - there could be a lot of language problem here.
One of the replies from OP suggests that the data lines should be extracted, sorted and headers re-inserted every 80 lines (page of A4?) except the every 80 lines was line 80, 180 etc (but that could have been a typo and should have been 80, 160,240 etc.)
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
On a muddled question like this where knowing what the input looks like and the rules for obtaining the output is really important, I would not continue the discussion until the OP posted the needed information. I would suggest you guys do the same and not continue posting guesses with no real information to go on.