ray.wurlod wrote:As you've described the algorithm the output file must end up exactly the same as the input file. Can you clarify the algorithm to show how it might be different?
Ray, what I need to do is append the content of file2 (flat, with 1 column) to the tail of file1(flat, with same column definition as file2) based on a match on a 'known' string in file1. The logic is-
1. If the input (file1) contains the string 'mmmm', then write all rows with @INROWNUM <= rownum of 'mmmm' to an TOPoutfile.
2. And all rows below 'mmmm' need to be written to BOTTOMoutfile.
(Essentially, splitting file1 into top and bottom parts, based on 'mmmm').
3. Then, append file2 (to be included file), to TOPoutfile.
4. Keep scanning (like fractals) the BOTTOMoutfile for the string 'mmmm', and perform the split-and-append(as discussed in steps 1-3) until there are no more 'mmmm' left.
So, if you look at this, it might 'look' dopey to some, but I posted it with a reason. I had only mentioned appending of the BOTTOMout file in my previous posting...which might have caused the confusion.
Further, it would be great if I could toggle the filenames of file1 and BOTTOMoutfile for every subsequent runs so that I could handle all the occurrence of the comparison string 'mmmm'. (Hence, my other post)
.
I have actually managed to do the splitting of the file into TOP and BOTTOM, and append the to-be-included file to the TOP file. Only thing I am having problem is that the number of occurrences of 'mmmm' can vary from a few hundreds to a thousand. Thus, this design calls for multiple runs of the same job with the 2 filenames toggling.
Thanks.
gateleys