|
<<SNIP>>
Today, the sqlstate gets a "01004" to inform me that "The value of a
string was truncated when assigned to another string data type with
a shorter length." So my if-test fails, and bad things happen. It's
true that the lengths are not matched, but if that had shown up in my
testing last March, I wouldn't be fixing production stuff today.
In the code below,
"equipment" in the EPstatus file is 16 A
and local variable "type" is 10 A
clear EquipmentTypes;
exec sql
declare EPstatusCursor cursor for
select DISTINCT equipment
from EPstatus
where order = :ServiceOrder
For Read only;
exec sql
open EPstatusCursor;
for x = 1 to 10;
exec sql
fetch next
from EPstatusCursor
into :Type;
if %subst(SQLSTATE : 1 : 2) = '00';
// SQL executed successfully
EquipmentTypes(x) = Type;
else;
NextElement = x;
LEAVE;
endif;
endfor;
Because of SQLSTATE 01004, my EquipmentTypes array is no longer
getting loaded.
<<SNIP>>
Anyone else have similar fun with this? Are there better ways I
should have coded this to prevent eventual upgrade trauma?
Got a lot of code out there that tests for
"if %subst(SQLSTATE : 1 : 2) = '00';"
Maybe not so much that involves
cursor-variable-to-host-variable-length-mismatch, but I sure got
blindsided here. Since I didn't find any references to "01004" in the
archives, I thought it might help someone else, unless I've totally
missed what's really causing my trouble.
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.