Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SQL CODE -310, query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Fri Jan 22, 2010 12:43 pm    Post subject: SQL CODE -310, query
Reply with quote

Hi,

Few of the fields in my DB2 table are defined as DECIMAL(7,0) and DECIMAL(18,0). I entered numeric data in these fields (without any decimals, as it is mentioned as 0).

-310 : DECIMAL HOST VARIABLE OR PARAMETER CONTAINS NON-DECIMAL DATA

But still when I run my pogram I am getting SQL code -310. Can you please help me out.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Fri Jan 22, 2010 12:47 pm    Post subject: Reply to: SQL CODE -310, query
Reply with quote

I tend to trust db2 judgement more than Yours!

review the steps You are using to provide the <numeric> value to the sql statement
use the dclgen command to find out the proper definition for the field You are using and convert the value accordingly

with the scarce info You have given us, the only suggestion is ...
fix Your program!
Back to top
View user's profile Send private message
bhairon singh rathore

New User


Joined: 19 Jun 2008
Posts: 91
Location: banglore

PostPosted: Fri Jan 22, 2010 2:28 pm    Post subject:
Reply with quote

Why dont you test it with IS NUMERIC clause
Back to top
View user's profile Send private message
lvbntapasvi

New User


Joined: 20 Jul 2006
Posts: 30

PostPosted: Fri Jan 22, 2010 3:13 pm    Post subject: Reply to: SQL CODE -310, query
Reply with quote

Hi Enrico, thanks for the quick reply. I am trying to implement your suggestion. While moving the data into the fields decimal or retrieving the data, can I use the fucntion DECIMAL so that the data is converted and retrieved?

Thanks in advance
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10257
Location: italy

PostPosted: Fri Jan 22, 2010 3:20 pm    Post subject: Reply to: SQL CODE -310, query
Reply with quote

here is the relevant text from the manual
Quote:
-310 DECIMAL HOST VARIABLE OR PARAMETER number CONTAINS NON-DECIMAL DATA


Explanation:
DB2 received nondecimal data from either an application (in the form of a host variable), function or a stored procedure (in the form of a parameter that was passed to or from function or a stored procedure).

number
Identifies either the host variable number (if the message is issued as a result of a FETCH, INSERT, UPDATE, MERGE, DELETE, SELECT, VALUES INTO, or SET assignment statement), or the parameter number (if the message is issued as the result of the invocation of a function, or a CALL statement).
System Action:

The statement cannot be processed.

Programmer Response:

Correct the application program or stored procedure. Ensure that all decimal variables or parameters contain valid System/370 packed decimal numbers.


IIRC the DECIMAL function is used to retrieve/fetch data ...
from the post looks more like the value in the host variable is not in the proper format ( packed )
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jan 22, 2010 8:48 pm    Post subject:
Reply with quote

Hello,

It will probably help someone help you if you post the host-variable value that is causing the error. . .
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 3 Mon May 29, 2017 8:10 pm
No new posts Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us