Page 1 of 1

ERROR(HOUSE_NUMBER, 17): 'Household_number' is not a declared variable or is a misspelled dictionary entry

Posted: March 8th, 2020, 1:30 am
by khurshid.arshad
Dear CSPro Team;
I am getting the error in “CSPro 7.3.1” on the following logic:

keylist(LISTING_DICT_NSER,caseIdList);
if length(caseIdList)>0 then
do numeric keyCtr = 1 while keyCtr <= length(caseIdList)
numeric household_number = tonumber(caseIdList(keyCtr)[32:3]);
enddo;
LISTING_DICT_NSER.HOUSE_NUMBER=Household_number+1;
else
LISTING_DICT_NSER.HOUSE_NUMBER=1;
endif;


When I declare variable “household_number” outside the loop then it is okay. Otherwise it gives error.
It is working fine in CSPro 7.1.3.

Best.
a.

Re: ERROR(HOUSE_NUMBER, 17): 'Household_number' is not a declared variable or is a misspelled dictionary entry

Posted: March 8th, 2020, 7:42 am
by Gregory Martin
CSPro has the concept of variable scope, so the variable household_number is only accessible within the loop. In the same way, a variable declared in one PROC isn't accessible in another PROC. In CSPro 7.3, we modified the compiler to support dot notation, and as part of that we tightened the scoping rules, so that's why it worked in CSPro 7.1 but not 7.3.

Re: ERROR(HOUSE_NUMBER, 17): 'Household_number' is not a declared variable or is a misspelled dictionary entry

Posted: March 9th, 2020, 5:34 am
by khurshid.arshad
Thanks. Gregory.

Best.
a.