View previous topic :: View next topic
|
Author |
Message |
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Please paste the exact DECLARE CURSOR statement instead of keying it, and use BBCode. |
|
Back to top |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
Hi Terry,
I don't know what is BBCode.
That's why I have mentioned the column position in my post |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
birdy K
New User
Joined: 05 Mar 2008 Posts: 72 Location: chennai
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Care to share the details on your solution for the benefit of others? |
|
Back to top |
|
|
RamsIBM
New User
Joined: 08 Jan 2007 Posts: 53 Location: Chennai
|
|
|
|
Hi Terry,
I have already spoke with Sys admin, he said that ' this was realted to system side' |
|
Back to top |
|
|
|