Use 'STEP -1' so as to work from the back to front. That would avoid the need to reset DISPLAY.LOOP and KEY.COUNT
1295 FOR DISPLAY.LOOP = KEY.COUNT TO 1 STEP -1 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) 1302 END 1303 NEXT DISPLAY.LOOP Marc Rutherford Principal Programmer Analyst Advanced Bionics LLC 661) 362 1754 -----Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson Sent: Wednesday, July 11, 2012 5:10 PM To: u2-users@listserver.u2ug.org Subject: [U2] trimming a list (a test of your ability) 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 _______________________________________________ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users