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

SQLTYPE in SQLDA = '16' with SQLSTATE 7002 and sqlcode -804


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

New User


Joined: 23 Jul 2007
Posts: 20
Location: India

PostPosted: Wed May 04, 2011 12:50 pm
Reply with quote

HI,

In one of my COBOL-DB2 programs, i am trying to run a dynamic multi row fetch cursor using SQLDA. But i am gettting -804 sqlcode.

PFB the sql queries.

EXEC SQL
PREPARE S1 FROM :WS-DSTRING
END-EXEC

SQLCODE AFTER PREPARE +000


EXEC SQL
DESCRIBE S1 INTO :SQLDA
END-EXEC

DESCRIBE SQLCODE +000

on displaying SQLTYPE in binary format:
WS-SQLTYPE = 10000
WS-SQLTYPE 20000

EXEC SQL
DECLARE CUSTCUR CURSOR
WITH ROWSET POSITIONING FOR S1
END-EXEC

DECLARE CURSOR SQLCODE +000

COMPUTE SQLDABC = 104
COMPUTE SQLN = 2

EXEC SQL
OPEN CUSTCUR
END-EXEC

EXEC SQL
FETCH NEXT ROWSET FROM CUSTCUR FOR 1 ROWS
USING DESCRIPTOR :SQLDA
END-EXEC

WS-SQLCODE -000804
WS-SQLSTATE07002

using diagnostics :
WS-MESSAGE-TEXTAN ERROR WAS FOUND IN THE APPLICATION PROGRAM INPUT PARAMETERS FOR THE SQL STATEMENT, REASON 16
which means
"Unrecognized output data type".

Please let me know if the SQLTYPE needs to be changed, from what i understand it should be obatined my means of DESCRIBE itself. And is SQLTYPE = 16 (decimal of 10000 binary) a valid value? since i dont see that code in the manuals.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Wed May 04, 2011 2:45 pm
Reply with quote

I'm no dynamic SQL coding expert but shouldn't you :

Code:
move 'WITH ROWSET POSITIONING' to ws-attr
EXEC SQL PREPARE S1 ATTRIBUTES :ws-attr FROM :WS-DSTRING

or

declare your cursor before preparing ?
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 SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
No new posts Getting sqlcode 805 while executing R... DB2 10
Search our Forums:

Back to Top