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

Problem while Declaring Cursor


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Wed Jun 13, 2007 2:50 am
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
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
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

Moderator Emeritus


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

PostPosted: Thu Jun 14, 2007 10:18 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top