Is this what the OP is asking about or I'm missing something? The 2 code 
fragments look totally different. We dont know what's happening in 
GET.UTILITY.RECORD or the significance of UTILITY.NAME and LAST.NAME to totally 
eliminate them during the 'optimisation'

I would rather do:
 
NEW.LIST = ''
LOOP
  REMOVE UTILITY.ID FROM KEY.LIST SETTING MORE
WHILE MORE:UTILITY.ID
  GOSUB GET.UTILITY.RECORD
   IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN CONTINUE
   NEW.LIST<-1> = UTILITY.ID
REPEAT
KEY.LIST = NEW.LIST
NEW.LIST = '' ;* free the memory
 

________________________________
 From: Kate Stanton <k...@walstan.com>
To: U2 Users List <u2-users@listserver.u2ug.org> 
Sent: Thursday, 12 July 2012, 4:27
Subject: Re: [U2] trimming a list (a test of your ability)
  
I am getting sucked in!

NLST = ""                                                       ;* For new
list
MAXI = DCOUNT(KEY.LIST<1>,@vM)         ;* Count items
FOR INO =1 TO MAXI                                   ;* Each key in list
  KEY.ID = KEY.LIST<1,INO>                        ;* A key ID
  LOCATE(KEY.ID,NLST,1;POS;'AL') ELSE  ;* see if there
    INS KEY.ID BEFORE NLIST<1,POS>       ;* Sort to list
  END
NEXT INO                                                      ;* Check all
keys
On 12 July 2012 12:09, Wjhonson <wjhon...@aol.com> wrote:

>
> 1295          FOR DISPLAY.LOOP = 1 TO KEY.COUNT
> 1296             UTILITY.ID = KEY.LIST<1,DISPLAY.LOOP>
> 1297             GOSUB GET.UTILITY.RECORD
> 1298             IF INDEX(UTILITY.NAME,LAST.NAME,1) = 0 THEN
> 1299                KEY.LIST = DELETE(KEY.LIST,1,DISPLAY.LOOP,0)
> 1300                DISPLAY.LOOP -= 1
> 1301                KEY.COUNT -= 1
> 1302             END
> 1303          NEXT DISPLAY.LOOP
>
>
> Comments?
>
>
> _______________________________________________
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>



-- 
Kate Stanton
Walstan Systems Ltd
4 Kelmarna Ave, Herne Bay, Auckland 1011, New Zealand
Phone: + 64 9 360 5310  Mobile: + 64 21 400 486
Email: k...@walstan.com
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to