IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sqlcode -310 DECIMAL HOST VARIABLE CONTAINS NON-DECIMAL DATA


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Jun 05, 2012 8:46 am
Reply with quote

There is a DECIMAL(6,0) db2 column whose cobol dclgen
variable is S9(6)V COMP-3. When trying to use update query on this column thru cob-db2 pgm, i get -310 sqlcode error.

I am taking the input from a CICS map variable declared PICIN=9(4). When i enter 0045 in the cics screen, the symbolic map variable 9(4) contains correct value 0045 only when displayed in the CEEMSG. I even tried moving the symbolic map variable to a temporary COMP-3 variable instead of the dclgen variable and used it as host variable in the update query, but still same prob.

Any solution to this?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 05, 2012 8:53 am
Reply with quote

Hello,

Suggest you post the host variable defnition, the "temporary" variable definition, the problem sql statement, and the code to move the data from one place to the host variable (assuming this is an insert or update).
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Jun 05, 2012 9:08 am
Reply with quote

Map variable GAI PIC 9(04)
Screen Input
Code:

GA CODE         :  0088     


Host variable from DCLGEN
10 HV-GA PIC S9(6)V USAGE COMP-3.

Temporary variable
01 WS-TEMP PIC S9(06)V COMP-3.

MOVE GAI TO HV-GA
MOVE GAI TO WS-TEMP

EXEC SQL
UPDATE RESULTTB
SET GA = :WS-TEMP
WHERE ID = :HV-ID
END-EXEC.

I have used both HV-GA and also WS-TEMP as host variables.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Tue Jun 05, 2012 9:26 am
Reply with quote

Can you show the 01 level of DCLGEN variable declaration. Did you try to display the host variable value before and after the update.
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Jun 05, 2012 9:30 am
Reply with quote

Another wierd observation,

There is another column CHAR(10) which we are updating using the query

Code:

EXEC SQL
   UPDATE RESULTTB
       SET RESULT = 'GOOD' 
       WHERE ID = :HV-ID
END-EXEC.


Even this is giving the -310 error only.
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Jun 05, 2012 1:37 pm
Reply with quote

Seems pretty obvious: HV_ID contains garbage.
Back to top
View user's profile Send private message
vasif

New User


Joined: 11 Feb 2008
Posts: 35
Location: Chennai

PostPosted: Tue Jun 05, 2012 7:09 pm
Reply with quote

And it seems pretty obvious that an assumption was made on HV-ID containing garbage. icon_wink.gif
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Jun 05, 2012 7:35 pm
Reply with quote

Did you try to do any numeric test?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 05, 2012 8:51 pm
Reply with quote

Hello,

Suggest you post the value of :HV-ID in hex.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jun 05, 2012 10:13 pm
Reply with quote

Quote:
Post subject: Sqlcode -310 DECIMAL HOST VARIABLE CONTAINS NON-DECIMAL DATA


I wonder why people keep on questioning db2/sql judgement about what is <good> and what is <bad>

what is important is not what the TS thinks/believes but what DB2/SQL wants icon_cool.gif
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Wed Jun 06, 2012 1:07 am
Reply with quote

vasif wrote:
And it seems pretty obvious that an assumption was made on HV-ID containing garbage. icon_wink.gif
Not really an assumption. It is an hypothesis based on the evidence presented. And a good one too. HV-ID is the next logical thing to check.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jun 06, 2012 7:22 am
Reply with quote

So, to repeat:
Quote:
Suggest you post the value of :HV-ID in hex.

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top