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

SQLCODE -804


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

New User


Joined: 04 May 2009
Posts: 5
Location: chennai

PostPosted: Thu Jan 26, 2012 3:24 pm
Reply with quote

I am getting sqlcode -804 error for select statement.

I am using static sql and there is no reason code getting displayed.

can anyone pls help in resolving this 804 issue??
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jan 26, 2012 3:26 pm
Reply with quote

Quote:
there is no reason code getting displayed.

seems that DB2 has different ideas icon_cool.gif

according to the manuals
Quote:
-804
AN ERROR WAS FOUND IN THE APPLICATION PROGRAM INPUT PARAMETERS FOR THE SQL STATEMENT, REASON reason

the reason is bad code
Back to top
View user's profile Send private message
ahmeds

New User


Joined: 04 May 2009
Posts: 5
Location: chennai

PostPosted: Thu Jan 26, 2012 3:28 pm
Reply with quote

enrico-sorichetti wrote:
Quote:
there is no reason code getting displayed.

seems that DB2 has different ideas --)

any idea how to display reason code..
DSNTIAR pgm is not giving any reason code..
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 26, 2012 3:30 pm
Reply with quote

publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.codes%2Fsrc%2Ftpc%2Fdb2z_sqlcodes.htm
Back to top
View user's profile Send private message
ahmeds

New User


Joined: 04 May 2009
Posts: 5
Location: chennai

PostPosted: Thu Jan 26, 2012 3:34 pm
Reply with quote

PeterHolland wrote:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.codes%2Fsrc%2Ftpc%2Fdb2z_sqlcodes.htm

this link shows that there is an error in sqlda... but am not using sqlda in my program...
and the sql query is working fine for sometime and not working sometime..
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 26, 2012 3:39 pm
Reply with quote

publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.apsg%2Fsrc%2Ftpc%2Fdb2z_displaysqlcadsntiar.htm
Back to top
View user's profile Send private message
ahmeds

New User


Joined: 04 May 2009
Posts: 5
Location: chennai

PostPosted: Thu Jan 26, 2012 3:41 pm
Reply with quote

PeterHolland wrote:
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=%2Fcom.ibm.db2z10.doc.apsg%2Fsrc%2Ftpc%2Fdb2z_displaysqlcadsntiar.htm


Code:
DSNT408I SQLCODE = -804, ERROR:  AN ERROR WAS FOUND IN THE APPLICATION     
         PROGRAM INPUT PARAMETERS FOR THE SQL STATEMENT                     
DSNT418I SQLSTATE   = 07002 SQLSTATE RETURN CODE                           
DSNT415I SQLERRP    = DSNXECP SQL PROCEDURE DETECTING ERROR                 
DSNT416I SQLERRD    = 204  0  0  1  1077952576  0 SQL DIAGNOSTIC           
         INFORMATION                                                       
DSNT416I SQLERRD    = X'FFFFFF34'  X'00000000'  X'00000000'                 
         X'FFFFFFFF'  X'40404040'  X'00000000' SQL DIAGNOSTIC               
         INFORMATION                                                       
                                                                           

i tried calling dsntiar also... it is giving the above information...but there is no reason code. :cry:
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Jan 26, 2012 3:47 pm
Reply with quote

07002 The call parameter list or control block is invalid.
Back to top
View user's profile Send private message
ahmeds

New User


Joined: 04 May 2009
Posts: 5
Location: chennai

PostPosted: Thu Jan 26, 2012 3:50 pm
Reply with quote

PeterHolland wrote:
07002 The call parameter list or control block is invalid.

but it is working fine for somerecords ... and not working for somerecords..
and am sure that it is data issue.. because i changed the position of records and ran the job...the job failed with same sqlcode -804 for different record .. icon_surprised.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: Thu Jan 26, 2012 6:49 pm
Reply with quote

What version of DB2 are you using? According to the version 9 manual, there should be a reason code along with the message.

Often this problem is due to an invalid host variable. I have seen this error when the length of an variable length host variable was set incorrect.

The V9 manual lists many possibilities. FWIW, I have bolded the ones that in my experience, are the most likely culprits in a static SQL program:

01 Open issued for non-cursor.
02 Close issued for non-cursor.
03 Prepare of EXECUTE IMMEDIATE.
04 Statement is not recognized.
05 No statement string present.
06 Bad SQLDA format in parameter list.
07 SQLDA length is invalid.
08 Unrecognized input data type.
09 Invalid length for input variable.
10 Invalid data length for output variable.
11 The value of SQLDABC is not consistent with the value of SQLD.
12 Invalid input data pointer.
13 Invalid output data pointer.
14 SQLN has too many items for SQLDABC.
15 Input RDI pointer is invalid.
16 Unrecognized output data type.
17 The value of the 7th byte of SQLDAID is not consistent with the data types contained in the SQLDA. The SQLDA contains a LOB type
host variable, but the 7th byte of SQLDAID is not set to '2' or
greater to indicate that the extended SQLVARs have been
allocated.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Fri Jan 27, 2012 1:06 pm
Reply with quote

Quote:
-804
AN ERROR WAS FOUND IN THE APPLICATION PROGRAM INPUT PARAMETERS FOR THE SQL STATEMENT, REASON reason
Explanation

The call parameter list or the SQLDA is invalid.
The call parameter list, which is created by the precompiler, might be invalid if the application programmer has modified the output of the precompiler, used a variable name beginning with 'SQL' in the application program, or overwritten the call parameter list in some other way.
The SQLDA, which is created by the application program, has an invalid data type or data length.
The value of SQLDABC is not consistent with the value of SQLD.
The following is the list of reason codes:
01
Open issued for non-cursor.
02
Close issued for non-cursor.
03
Prepare of EXECUTE IMMEDIATE.
04
Statement is not recognized.
05
No statement string present.
06
Bad SQLDA format in parameter list.
07
SQLDA length is invalid.
08
Unrecognized input data type.
09
Invalid length for input variable.
10
Invalid data length for output variable.
11
The value of SQLDABC is not consistent with the value of SQLD.
12
Invalid input data pointer.
13
Invalid output data pointer.
14
SQLN has too many items for SQLDABC.
15
Input RDI pointer is invalid.
16
Unrecognized output data type.
17
The value of the 7th byte of SQLDAID is not consistent with the data types contained in the SQLDA. The SQLDA contains a LOB type host variable, but the 7th byte of SQLDAID is not set to '2' or greater to indicate that the extended SQLVARs have been allocated.
18
An ARRAY SQLTYPE was specified in an SQLDA.
19
Invalid program name.
System action

The statement cannot be processed.

System programmer response

Examine the application program for any of the errors noted under the explanation above. In general, the application programmer should not attempt to modify the output of the precompiler.

SQLSTATE

07002


www-01.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/com.ibm.db2z11.doc.codes/src/tpc/n804.dita
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