If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error Reading a Table using DB2 Connect

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-02-12, 12:09
gbrito gbrito is offline
Registered User
 
Join Date: Dec 2003
Location: El Salvador
Posts: 18
Red face Error Reading a Table using DB2 Connect

Hello for everyone, I have problems reading an AS/400 file using DB2 Connect. Follow is the configuration and table specifications in order that you can understand the situation:

DB2/400 v5R4
DB2 Enterprise in Linux with DB2 Connect both 9.7 version SP 3.

AS/400 Table call CUMST, this table has about 92 columns however, into this columns have two specific columns that cause the problem: CUSILV and CUSMAM both of them are defined as NUMERIC(1,0) and NOT NULL, for some reason the CUSILV and CUSMAN has ++ as value in some records, I realize a SQL query in the AS/400 and get the following output:

SELECT CUSCUN, CUSILV, CUSMAM FROM BACHIFILES.CUMST WHERE CUSCUN = 12345

The Ouput:

CUSCUN CUSILV CUSMAN
--------------- ------------- -----------------
12345 ++ +++

When I used DB2 LUW to query the same table using DB2 Connect I receive the followin error:

SQL0304N A value cannot be assigned to a host variable because the value is
not within the range of the host variable's data type. SQLSTATE=22003

My Question is: exist some SQL command in DB2 LUW in order to determine wich records in the AS/400 has the same problems??? I'm try using a COALESCE but the field is not null and has a value.

Please your help.

Best Regards

Gerardo B.
Reply With Quote
  #2 (permalink)  
Old 02-03-12, 06:30
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,195
Quote:
defined as NUMERIC(1,0) and NOT NULL, ... has ++ as value
I couldn't understand. Why is it possible?

++ is not numeric and length may be 2.
How was it stored in NUMERIC(1,0)?

Last edited by tonkuma; 02-03-12 at 06:35.
Reply With Quote
  #3 (permalink)  
Old 02-03-12, 08:49
gbrito gbrito is offline
Registered User
 
Join Date: Dec 2003
Location: El Salvador
Posts: 18
Really don't know how the table has that values inserted, I realized an update over a field that found with this error trying to put a NULL VALUE, Character and get a SQL error just the database must response in that case, then I update with a numeric value and the SQL works fine. The problems is that the table has about 2 millions of records and there is imposible to match wich fields had this problems inside.

Try to change te QCCSID in the AS/400 and in the DB2 Connect with no success. The AS/400 has the value 65535 for QCCSID stored at *SYSVAL, the DB2 Connect has the same value.

I'm investigating the problem....

Best Regards
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On