Try this (untested):

LOOKUP AUTOADD COUNT gives you the first one trivially.  At
end-of-file you have the last one on the tertiary output.  (You need
the COUNT option to see them all.)  Discard the ones with a count of 1
as you've already got those, then discard the count.

If you want to retain the sequence, you pass the tertiary output less
the ones with a count of one to the secondary of another LOOKUP that
selects the primary record matching the count.  As you will have to
buffer the primary stream from the first lookup, you need to FANINANY
the first ones into the file, buffer them, and take them out again and
pass the balance to the second LOOKUP.

   j.

2009/5/27 Glenn Knickerbocker <[email protected]>:
> In my log file where I want to keep the first and last of each run, now
> I'm going to have records for several different servers.  In each run of
> "OK" records, I want to keep the first and last record for each server.
> For example, I'd want to keep the records marked > in this excerpt:
>
>  > t0 error on some server
>  > t1 OK server1
>  > t2 OK server2
>   t3 OK server1
>   t4 OK server1
>   t5 OK server1
>  > t6 OK server2
>  > t7 OK server3
>  > t8 OK server1
>  > t6 error on some other server
>
> Anybody got a way to do this?  Obviously my UNIQUE|PREDSELECT trick's no
> good for the last occurrences, since I have to wait till the end of the
> run to identify them.  I'm wondering if, to keep them in order, I might
> actually have to number and resort the records in each run--note that
> the first occurrence of server3 in my example falls in between the last
> occurrences of the others.
>

Reply via email to