Razzak - You are always very meticulous in predefining and clearing
variables, but I noticed that you didn't predefine the indicator
variables for the FETCH statements. Apparently they don't need to be
predefined, but might that practice come to bite us in future upgrades?
Thanks much,
Doug
So, in your specific case, using your example, note the following:
01. Pre-Define all variables with appropriate data types before
the WHILE loop.
02. When converting the LEGACY database and command files, make
sure to update the table/column names to avoid any conflict
with R:BASE RESERVED words, such as column name "VALUE".
03. Avoid table/column names with special characters, such as "#".
03. Sample Code:
-- start
SET VAR vItemNo TEXT = NULL
SET VAR vCostLbs CURRENCY = NULL
SET VAR vItemValue CURRENCY = NULL
SET VAR vDateRcvd DATE = NULL
SET VAR vInHouse TEXT = NULL
SET ERROR MESSAGE 705 OFF
DROP CURSOR c1
SET ERROR MESSAGE 705 ON
DECLARE c1 CURSOR FOR SELECT +
ITEM#,COSTLBS,VALUE,INWEIGHT,DATERCVD,INHOUSE +
FROM ICMAIN ORDER BY ITEM#
OPEN c1
FETCH c1 INTO +
vItemNo INDIC ivItemNo, +
vCostLbs INDIC ivCostLbs, +
vItemValue INDIC ivItemValue, +
vDateRcvd INDIC ivDateRcvd, +
vInHouse INDIC ivInHouse
WHILE SQLCODE <> 100 THEN
-- Do what you have to do
FETCH c1 INTO +
vItemNo INDIC ivItemNo, +
vCostLbs INDIC ivCostLbs, +
vItemValue INDIC ivItemValue, +
vDateRcvd INDIC ivDateRcvd, +
vInHouse INDIC ivInHouse
ENDWHILE
DROP CURSOR c1
CLEAR VARIABLES iv%
-- End
Hope that helps!
Very Best R:egards,
Razzak.