One of our programmers wrote this snippet: FOR YY=1 TO DCOUNT(WORK.ITEM.REC<17>,VM) LISTNUMBER='' SQLCOMMAND='' UNISTATEMENT='SELECT BPM.WORKITEMS WITH A1="':WORK.ITEM.REC<1>:'" AND WITH A2="':WORK.ITEM.REC<2>:'" AND WITH A17="':WORK.ITEM.REC<17,YY>:'" AND WITH A24#"C" AND WITH A24#"R" AND WITH A24#"F"' *MY.REC<1>=UNISTATEMENT CALL SR.EXECUTESQL(LISTNUMBER,UNISTATEMENT,SQLCOMMAND) READNEXT DEPENDANT.ID ELSE * NO ACTIVE ITEMS LEFT I NEED TO UPDATE THE STATUS OF THE DEPENDANT TASK CALL SR.READSQL('BPM.WORKITEMS',DEP.TASK.REC,WORK.ITEM.REC<17,YY>,'') DEP.TASK.REC<24>='A' DEP.TASK.REC<8>=DATE() DEP.TASK.REC<9>=TIME() CALL SR.WRITESQL('BPM.WORKITEMS',DEP.TASK.REC,WORK.ITEM.REC<17,YY>) END NEXT YY
The FOR loop has 2 values to iterate, so it does 2 loops. The function SR.EXECUTESQL()does the SELECT call. Loop 1 returns 2 keys found. Loop 2 returns 0 keys found. What's odd is that the select list is empty on loop iteration 2 and the READNEXT is populated the ID with the second key from the first iteration. I looked in the help PDFs and all I found was a reference to a corrected error relating to memory not being released if the READNEXT did not exhaust the SELECT list. Any thoughts? We have since changed our strategy to check the count returned instead. But it would be nice to know that others have encountered this as well. Jeffrey Lee Senior Analyst/Programmer IT Vision Australia Pty Ltd (ABN: 34 309 336 904) PO Box 881, Canning Bridge WA 6153 Level 3, Kirin Centre, 15 Ogilvie Road, Applecross, WA, 6153 P: (08) 9315 7000 F: (08) 9315 7088 W: http://www.itvision.com.au ___________________________________________________________ NOTICE : This e-mail and any attachments are intended for the addressee(s) only and may contain confidential or privileged material. Any unauthorised review, use, alteration, disclosure or distribution of this e-mail (including any attachments) by an unintended recipient is prohibited. If you are not the intended recipient please contact the sender as soon as possible by return e-mail and then delete both messages. ___________________________________________________________ ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/