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

Error in Cursor: ILLEGAL SYMBOL


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

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Nov 06, 2008 10:54 am
Reply with quote

Hi,

I am facing a problem in my project.

I have declared a following CURSOR in my cobol-DB2 program.

Code:
EXEC SQL
      DECLARE craccur CURSOR FOR
      SELECT cracket_code, item_name, shop_code
      FROM cracker
      WHERE stock <= repurchase_level
END-EXEC.

I have declared the cursor in Working storage section.

“EXEC SQL” starts in the column no 12.

“DECLARE craccur” starts in the column no 16.

I am getting the couple of following error, when I precompile the program:

CURSOR 'CURSOR' WAS NOT DECLARED

ILLEGAL SYMBOL "CRACCUR". SOME SYMBOLS THAT MIGHT BE LEGAL ARE:

<END-OF-STATEMENT>

Let me know where I am wrong.

Thanks in advance.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Nov 06, 2008 11:14 am
Reply with quote

Please paste the exact DECLARE CURSOR statement instead of keying it, and use BBCode.
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Nov 06, 2008 11:45 am
Reply with quote

Hi Terry,

I don't know what is BBCode.

That's why I have mentioned the column position in my post
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 Nov 06, 2008 12:07 pm
Reply with quote

Hello,

Your sql has been "Code"ed. This is how you should post code, jcl, data, etc - anything that needs alignment preserved. There is also Preview which allows you to see your post as it will appear to the forum (rather than how it appears in the reply editor). When you are satisfied with the appearance of your post, Submit. The "Code" tag is near the top of the Reply panel.

What is the sequence of the EXEC SQL statements in your code.

When the errors were presented, what were the message ids?
Back to top
View user's profile Send private message
birdy K

New User


Joined: 05 Mar 2008
Posts: 72
Location: chennai

PostPosted: Thu Nov 06, 2008 12:18 pm
Reply with quote

hi,

May be the cursor name is wrong . Declared one is different from opening. Else check the statement no it gives in error message.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Nov 06, 2008 1:17 pm
Reply with quote

would have been nice to know what page/ln were referenced with the error message.

if lowercase is allowed for imbedded sql,
(don't know, never use lower case, no desire to test)
then I imagine the OPEN cursor statement was generating the errror because the DECLARE cursor statement was not physically first in the program (before the OPEN).
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Wed Nov 12, 2008 3:10 pm
Reply with quote

Hi All,

Thanks for your reply.

above error casued, due to compiler settings in my shop, I have confirmed with my system admin.

Once again thanks for your time.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Wed Nov 12, 2008 6:48 pm
Reply with quote

Care to share the details on your solution for the benefit of others?
Back to top
View user's profile Send private message
RamsIBM

New User


Joined: 08 Jan 2007
Posts: 53
Location: Chennai

PostPosted: Thu Nov 13, 2008 7:49 pm
Reply with quote

Hi Terry,

I have already spoke with Sys admin, he said that ' this was realted to system side'
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 Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Getting Error while trying to establi... DB2 3
Search our Forums:

Back to Top