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
 

 

Getting sql code -313, while execting Dynemic sql cursor?

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

New User


Joined: 11 Apr 2006
Posts: 93

PostPosted: Thu Aug 21, 2008 2:49 pm    Post subject: Getting sql code -313, while execting Dynemic sql cursor?
Reply with quote

EXEC SQL
DECLARE ARW_X9_CURSOR CURSOR FOR DYNSELECT
END-EXEC.

EXEC SQL
PREPARE DYNSELECT FROM :WS-DYN-SELECT
END-EXEC.


EXEC SQL
OPEN ARW_X9_CURSOR USING :WS-DBL-SEND-ABA,
:WS-DBL-RECV-ABA,
:WS-DBL-RESEND-IND,
:WS-DBL-FILE-RECV-IND,
:WS-DBL-CREATE-DATE,
:WS-DBL-CREATE-TIME,
:WS-DBL-BUSINESS-DATE,
:WS-DBL-CASH-LET-ID,
:WS-DBL-BUNDLE-ID,
:WS-DBL-HEADER
END-EXEC

The Dyn select statement is contain the SQL STATEMENT is

SELECT * FROM ARW0.ARWX9_T009
WHERE SEND_RT_NO = ? ',
AND RECV_RT_NO = ? ',
AND RESEND_IND = ? ',
AND FILE_RECV_CNT = ? ',
AND CREA_DTE = ? ',
AND CREA_TME = ? ',
AND CASH_LET_BUS_DTE = ? ',
AND CASH_LET_ID = ? ',
AND BUNDLE_ID = ? ',
AND CNTL_REC_IND = ?)

uBION

SELECT * FROM ARW0.ARWX9_T010
WHERE SEND_RT_NO = ? ',
AND RECV_RT_NO = ? ',
AND RESEND_IND = ? ',
AND FILE_RECV_CNT = ? ',
AND CREA_DTE = ? ',
AND CREA_TME = ? ',
AND CASH_LET_BUS_DTE = ? ',
AND CASH_LET_ID = ? ',
AND BUNDLE_ID = ? ',
AND CNTL_REC_IND = ?)

UNION

SELECT * FROM ARW0.ARWX9_T011

WHERE SEND_RT_NO = ? ',
AND RECV_RT_NO = ? ',
AND RESEND_IND = ? ',
AND FILE_RECV_CNT = ? ',
AND CREA_DTE = ? ',
AND CREA_TME = ? ',
AND CASH_LET_BUS_DTE = ? ',
AND CASH_LET_ID = ? ',
AND BUNDLE_ID = ? ',
AND CNTL_REC_IND = ?)

If sql statement contain UNION(more that one table),I am gettinh sqlcode -313.If only one table(no union) the above statement is working fine.

For more than one table how do i maintain OPEN statement in Dynemeic Sql for giving inputs to the where clause of sellect query?
Back to top
View user's profile Send private message

PeD

Active User


Joined: 26 Nov 2005
Posts: 456
Location: Belgium

PostPosted: Thu Aug 21, 2008 2:58 pm    Post subject:
Reply with quote

Is this a typo?
Code:
uBION
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 21, 2008 3:12 pm    Post subject:
Reply with quote

I had sworn off making caustic remarks, but what about the description of an sql code -313 don't you understand?

Quote:

-313 THE NUMBER OF HOST VARIABLES
SPECIFIED IS NOT EQUAL TO THE
NUMBER OF PARAMETER MARKERS

Explanation: The number of host variables specified in the EXECUTE or OPEN statement
is not the same as the number of parameter markers (question marks) appearing in the prepared SQL statement.

System Action: The statement cannot be executed. Programmer

Response: Correct the application program so that the number of host
variables specified in the EXECUTE or OPEN statement is the same as the
number of parameter markers appearing in the prepared SQL statement.

The DESCRIBE INPUT SQL statement
can be used to determine the expected number of input
parameter markers


select * ?
only an ***** would do that, especially in dynamic sql.
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 How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm


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