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

Reply via email to