473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

SMALLINT casting difference on Windows vs AIX

Hi DB2 newsgroup,

I have encountered a difference between our development DB2 on Windows
and the test environment on AIX.
If using the LOCATE scalar function with a SMALLINT as LENGTH parameter
the same statement produces different results on Windows (correct) than
on AIX (wrong). The same statement using an INTEGER instead of SMALLINT
produces the correct result in both environments.

Is there a reason why using a SMALLINT instead of an INTEGER leads to
another result in both environments? I tried to specify the string unit
(CODEUNITS16, CODEUNITS32, or OCTETS) but the results still differ.
As you can see below the statement 4 and 5 shows that the error handling
differs and that the SMALLINT handling or casting may be problem here. I
see no reason why the SMALLINT casting should fail.

Both databases are on current FixPack level (V9 FP5), using the same
codepage (1208) and same codeset (but displays in differing cases: Win:
utf-8, AIX: UTF-8).

Any hints or tips?

Thanks in advance,
Michael

Test statements:
values locate('A', 'A', CAST(1 AS SMALLINT)); --different
values locate('A', 'A', CAST(1 AS INTEGER)); --same
values locate('A', 'A', CAST(CAST(1 AS SMALLINT) AS INTEGER)); --same
values locate('A', 'A', CAST(0 AS SMALLINT)); --nearly the same,
differing error message
values locate('', '', CAST(0 AS SMALLINT)); --different
Result on Windows:
db2 =values locate('A', 'A', CAST(1 AS SMALLINT));
==1

db2 =values locate('A', 'A', CAST(CAST(1 AS SMALLINT) AS INTEGER));
==1

db2 =values locate('A', 'A', CAST(1 AS INTEGER));
==1

db2 =values locate('A', 'A', CAST(0 AS SMALLINT));
==SQL0171N The data type, length or value of argument "start" of
routine "SYSIBM.LOCATE" is incorrect. SQLSTATE=42815

db2 =values locate('', '', CAST(0 AS SMALLINT));
==SQL0171N The data type, length or value of argument "start" of
routine "SYSIBM.LOCATE" is incorrect. SQLSTATE=42815
Result on AIX:
db2 =values locate('A', 'A', CAST(1 AS SMALLINT));
==0

db2 =values locate('A', 'A', CAST(CAST(1 AS SMALLINT) AS INTEGER));
==1

db2 =values locate('A', 'A', CAST(1 AS INTEGER));
==1

db2 =values locate('A', 'A', CAST(0 AS SMALLINT));
==SQL0171N The data type, length or value of argument "start" of
routine "" is incorrect. SQLSTATE=42815

db2 =values locate('', '', CAST(0 AS SMALLINT));
==1
Jun 27 '08 #1
0 2706

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ree32 | last post by:
For a SQL statement in an Alias column I am am combing several columns. But I am having problems with one column as it is a smallint. I get this error Syntax error converting the nvarchar value...
10
by: Dirk Vanhaute | last post by:
I have only small knowledge of c++, but I would like to compile the example in http://support.microsoft.com/kb/q246772/ HOWTO: Retrieve and Set the Default Printer in Windows I included "#include...
7
by: yufufi | last post by:
lets say we have a 'shape' class which doesn't implement IComparable interface.. compiler doesn't give you error for the lines below.. shape b= new shape(); IComparable h; h=(IComparable)b;...
18
by: Marco | last post by:
I need to get a iterator from any generic collection. public class .... GetIterator(Object collection) { ..... }
7
by: S. Lorétan | last post by:
Hi guys, Sorry for this stupid question, but I don't know why it isn't working. Here is my (example) code: namespace Test { class A { public string Label1; }
6
by: Nishu | last post by:
Hi all, What is difference between typecasting and casting? I used to think that both are same; but few days back someone pointed out here that these are different. Vague guess, Is it that...
9
by: Jess | last post by:
Hello, It seems both static_cast and dynamic_cast can cast a base class pointer/reference to a derived class pointer/reference. If so, is there any difference between them? In addition, if I...
5
by: jason.cipriani | last post by:
There have been some recent threads about casting pointers to and from void* that have me rethinking some of my usual practices. I have a couple of questions. 1. What is the purpose of C++'s...
19
by: =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post by:
I'm doing my c# more and more like i used to code c++, meaning i'm casting more often than creating an instance of objects. like : protected void gvOrderDetailsRowDataBound(object sender,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.