Also first DROP CURSOR cursor1 You may get an error saying the cursor does not exist but that is an accepatable error, expected most times.
Dennis McGrath ________________________________ From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Friday, June 19, 2009 11:14 AM To: RBASE-L Mailing List Subject: [RBASE-L] - Re: Converting from pointer to fetch Stas: This is timely since just this week we had a big discussion about changing pointers to fetch statements! There are multiple ways to design a declare cursor. Here's how I would do it. The "while 1 = 1" is kind of a dummy statement that will always evaluate as true. The "IF Sqlcode" that follows the fetch is what will break out of the while loop as soon as there is no more data to process. I notice you didn't have an "open" in your example so you need to have that in there. DECLARE cursor1 CURSOR FOR SELECT itemnumber, + iccostlbs, icvalue, inweight, datereceived, inhouse + FROM icmain WHERE inhouse CONTAINS 'Y' + ORDER BY itemnumber ASC OPEN cursor1 WHILE 1 = 1 THEN FETCH cursor1 INTO itemnumber, iccostlbs, + icvalue, inweight, datereceived, inhouse IF SQLCODE = 100 THEN BREAK ENDIF -- do your processing here ENDWHILE Karen Stas' Gawel [[email protected]] Tube Methods, Inc. 610-279-7700 I am converting an rbase command file from an older version of rbase to rb8 but I do not know how to completely convert the pointer command. This is the old syntax involving the pointer command SET POINTER #1 STAT1 FOR ICMAIN WHERE + INHOUSE = "Y" SORTED BY ITEM# WHILE STAT1 = 0 THEN SET VAR ITEM# = ITEM# IN #1 SET VAR COSTLBS = COSTLBS IN #1 SET VAR VALUE = VALUE IN #1 SET VAR INWEIGHT = INWEIGHT IN #1 SET VAR DATERCVD = DATERCVD IN #1 SET VAR INHOUSE = INHOUSE IN #1 NEXT #1 STAT1 ENDWHILE This is as far as I got. DECLARE cursor1 CURSOR FOR SELECT itemnumber, + iccostlbs, icvalue, inweight, datereceived, inhouse + FROM icmain WHERE inhouse CONTAINS 'Y' + ORDER BY itemnumber ASC WHILE STAT1 = 0 THEN FETCH FROM cursor1 INTO itemnumber, iccostlbs, + icvalue, inweight, datereceived, inhouse ENDWHILE I am having trouble with what STAT1 is and what it should be converted to. Also, I receive the error message -ERROR- The cursor [cursor1] is already defined. (708) but I have checked and my syntax appears to be right for the declare and fetch commands. Note that some of the coulumn names changed from the older version of the table and the newer one though the table name is still the same and that this is not the whole program.

