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

Use of 'Like' in Cursor Declration


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

New User


Joined: 11 Apr 2007
Posts: 5
Location: mumbai

PostPosted: Thu Apr 26, 2007 3:28 pm
Reply with quote

Hi.
I have cont-id field in my file as 12345

in my table thid id is like 12345A,12345B,12345C

i HAVE TO FETCH ALL THESE RECORDS FROM THE TABLE.
I want to use cursor for that.

What could be the cursor declaration?
Back to top
View user's profile Send private message
balanim

New User


Joined: 29 Nov 2006
Posts: 6
Location: India

PostPosted: Thu Apr 26, 2007 4:51 pm
Reply with quote

you can use simple cursor declaration.

declare a host variable
DCL HOSTV char(4) init(1234);

then declare a cursor.
EXEC SQL DECLARE CURLIKE CURSOR FOR
SELECT FROM tablename

WHERE CONT-ID LIKE :HOSTV

FOR FETCH ONLY;

This example is for PL/I if you want for cobol change accordingly.

Hope this helps

Cheers
Bnim
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 Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
No new posts Multiple rows within Cursor when Coun... DB2 14
No new posts Dynamic cursor name in Cobol program COBOL Programming 1
Search our Forums:

Back to Top