Interesting but I think each time you do a LOCATE it must scan the entire 
string from front to back.

I think on very large lists, you might see a speed improvement if you sort, 
append and then do a backward walk to remove dups.
Of course that's much more complicated.



-----Original Message-----
From: dennis bartlett <[email protected]>
To: Marco Manyevere <[email protected]>; U2 Users List 
<[email protected]>
Sent: Fri, Jul 13, 2012 7:59 am
Subject: Re: [U2] trimming a list (a test of your ability)


Actually the way I wrote it the first time was correct but I needed to test
or null x's i.e.
z=''
oop
   remove x from y setting more
   if x ne '' then
       locate (...) else z := x:@fm
   end
hile more
epeat
On 13 July 2012 19:30, Marco Manyevere <[email protected]> wrote:
> You must do "WHILE MORE:NEXT.ID" or "WHILE NEXT.ID:MORE" otherwise the
 last NEXT.ID will not be processed



 ________________________________
  From: dennis bartlett <[email protected]>
 To: U2 Users List <[email protected]>
 Sent: Friday, 13 July 2012, 7:09
 Subject: Re: [U2] trimming a list (a test of your ability)

 Hi Steven

 The REMOVE statement process a multivalued list. The SETTING clause will
 set the variable to either 3, or 2, or 1, or 0 depending on the value of
 the delimiter last encountered...
    1 for @FM
    2 for @VM
    3 for @SM
    0 for End Of String

 If the array consists only of @FM, then MORE will be set to 1 for each
 iteration (since the delimiter it is encountering each time is an @FM) and
 then, when the last element is read, MORE will be set to ZERO, and the
 WHILE MORE will fail, thus the loop is exited.


 If FM.ARRAY is empty, MORE will return as 0 and the loop will exit, but
 you're right - the "WHILE MORE" line should be one line higher..

     UNIQ.LIST = ''
     LOOP
         REMOVE NEXT.ID <http://next.id/> FROM FM.ARRAY SETTING MORE
     WHILE MORE
         LOCATE(NEXT.ID <http://next.id/>,UNIQ.LIST,1;POS) ELSE
 UNIQ.LIST<-1> = NEXT.ID <http://next.id/>
     REPEAT

 the WHILE statement is in effect a "while it is not zero" and the second it
 becomes a zero, the loop exits.
 _______________________________________________
 U2-Users mailing list
 [email protected]
 http://listserver.u2ug.org/mailman/listinfo/u2-users
 _______________________________________________
 U2-Users mailing list
 [email protected]
 http://listserver.u2ug.org/mailman/listinfo/u2-users

______________________________________________
2-Users mailing list
[email protected]
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to