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
 

 

Problem while Declaring Cursor

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

New User


Joined: 28 Dec 2005
Posts: 24

PostPosted: Tue Jun 12, 2007 10:20 pm    Post subject: Problem while Declaring Cursor
Reply with quote

I've coded the following cursor declaration in Procedure Division. DSUNT001.V_BII_CVR_ITEM_CUR is a view on which i'm trying to use a cursor.

Code:
 EXEC SQL                                       
    DECLARE ITEM_CSR CURSOR FOR                 
      SELECT                                     
         COVER_ITEM_ID,                         
         COVER_ITEM_NO,                         
         SEQ_ALPHA,                             
         SEQ_ROMAN                               
      FROM DSUNT001.V_BII_CVR_ITEM_CUR           
      WHERE                                     
          FK_COV_ITEMGRP_ID = :W04-VAR-CIG       
 END-EXEC       



I'm getting the following error during DB2 SQL PRECOMPILE for the Open Cursor statement.

DSNH504I E DSNHSMUD LINE 1160 COL 27 CURSOR "ITEM_CSR" WAS NOT DECLARED


I have checked the select statement in SPUFI and it works perfectly fine. I also have another cursor declared in the same program but for a different table and even that is error free in Pre-Compile.

Can anyone tell me where I mite be making a mistake ?

cheers
CB
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 13, 2007 2:50 am    Post subject:
Reply with quote

Hello,

Do you have some other code that successfully gets thru the precompiler that also uses that view?

If you post more of your code that may help - especially before and after line 1160. What does the precompiler show for the problem cursor declaration? What does the precompiler show for the successful declaration?

My guess is that there is a typo we've not seen here or there is something amiss with that particular view.
Back to top
View user's profile Send private message
veerababu_p

New User


Joined: 18 Mar 2006
Posts: 5
Location: mumbai

PostPosted: Wed Jun 13, 2007 10:32 am    Post subject:
Reply with quote

Please code in working storage insted of procedure division.
Back to top
View user's profile Send private message
catchyblues

New User


Joined: 28 Dec 2005
Posts: 24

PostPosted: Thu Jun 14, 2007 9:06 pm    Post subject:
Reply with quote

got this fixed now....... problem is due to the column where I
started the EXEC SQL for the declare cursor.....

thnx once again....

dick scherrer wrote:
Hello,

Do you have some other code that successfully gets thru the precompiler that also uses that view?

If you post more of your code that may help - especially before and after line 1160. What does the precompiler show for the problem cursor declaration? What does the precompiler show for the successful declaration?

My guess is that there is a typo we've not seen here or there is something amiss with that particular view.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 14, 2007 10:18 pm    Post subject:
Reply with quote

You're welcome.

Thanks for posting the solution icon_smile.gif
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 Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


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