Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Dynamic SQL -Fetch Cursor

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

New User


Joined: 02 Aug 2011
Posts: 17
Location: India

PostPosted: Tue Mar 12, 2013 3:31 pm    Post subject: Dynamic SQL -Fetch Cursor
Reply with quote

Hi,

I am fetching from a cursor using Dynamic SQL,

EXEC SQL
DECLARE DT2 CURSOR FOR SEL2
END-EXEC.

EXEC SQL
PREPARE SEL2 FROM :WS-SQL-AREA-G
END-EXEC.
EXEC SQL
DESCRIBE SEL2 INTO :SQLDA2
END-EXEC.

EXEC SQL
OPEN DT2
USING
: CTRL-YEAR
,:CTRL-QTR
END-EXEC
EXEC SQL
FETCH DT2
USING DESCRIPTOR :SQLDA2
END-EXEC.


THe problem statement : while fetching the data from the cursor. we expect the cursor to stop after a year and quarter is processed. Say we want to fetch the data for 2012 and 4th quarter, cursor doesnt stop after all the data for the above mentioned year and quarter is processed and did not give a SQL code 100 after all the rows have been processed. Instead the cursor continues to fetch the data for 2013 and 1st quarter as well .

Please sugeest!!
Back to top
View user's profile Send private message

prino

Senior Member


Joined: 07 Feb 2009
Posts: 1120
Location: Oostende, Belgium

PostPosted: Tue Mar 12, 2013 4:31 pm    Post subject:
Reply with quote

Wij runderen, wij glunderen...

You use Dynamic SQL, so show us the contents of

Code:
WS-SQL-AREA-G


That's how SQL injections work...
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 Get line number where cursor is from ... satish.ms10 CLIST & REXX 3 Wed Oct 24, 2018 12:23 am
No new posts DB2 SQL Query to fetch all instances ... MallikarjunSM DB2 2 Thu Sep 27, 2018 6:46 pm
No new posts ISPF 3.4 edit of a ps file, disp use... Carrie Da Silva TSO/ISPF 3 Fri Sep 21, 2018 3:01 am
No new posts Number of Packages required for stati... manojthokala7 DB2 4 Mon Sep 17, 2018 7:14 pm
No new posts Delete Multiple rows in chunks by usi... dharmaraok DB2 5 Tue Sep 11, 2018 8:44 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us