Page 1 of 1

IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Mon Nov 10, 2014 4:56 pm
by Sangitha
Hi,

I am compiling a COBOL-DB2 pgm. I am getting below error msg.

Code: Select all

IGYPS0225-S An "EXEC SQL" statement was found, but the "SQL" compiler option was not in effect. The statement was discarded. 
the strange thing is, when i am using SQL query inside the copy book I am getting the error but if the call it directly the compilation was successfull.

could you help me?

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Mon Nov 10, 2014 6:58 pm
by nicc
The SQL recompiler runs before the COBOL compiler. It is the COBOL compiler that brings in the copybook so your SQL statement comes in after the SQL pre-compiler. (The pre-compiler converts the SQL code to COBOL, PL/1 or whatever language you are using that a pre-compiler exists for).

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Mon Nov 10, 2014 7:08 pm
by Anuj Dhawan
Along with what Nic has said, I'd also like to know what "compiling tool" are you using to compile your program?

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Mon Nov 10, 2014 8:52 pm
by William Collins
To put it another way, you shouldn't have SQL statements in COBOL copybooks if you are using the pre-compiler, because the pre-compiler does not expand copybooks (it would have to re-write them if it did, and that would very quickly become a big mess).

The message is referring to the compiler option SQL, which when on uses the SQL co-processor, directly from the compiler (so no pre-processor step needed). Then the SQL can be in a copybook.

What exactly you've got wrong, we can't guess. Ask your colleagues how they do what you want to do.

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Tue Nov 11, 2014 11:45 am
by Sangitha
nicc wrote:The SQL recompiler runs before the COBOL compiler. It is the COBOL compiler that brings in the copybook so your SQL statement comes in after the SQL pre-compiler. (The pre-compiler converts the SQL code to COBOL, PL/1 or whatever language you are using that a pre-compiler exists for).
Fine but what should I do to rectify the error now?

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Tue Nov 11, 2014 11:49 am
by Sangitha
Anuj Dhawan wrote:Along with what Nic has said, I'd also like to know what "compiling tool" are you using to compile your program?
I'm using chaneman for this.

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Tue Nov 11, 2014 4:49 pm
by William Collins
What exactly you've got wrong, we can't guess. Ask your colleagues how they do what you want to do.

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Tue Nov 11, 2014 5:25 pm
by Robert Sample
Fine but what should I do to rectify the error now?
Take the EXEC SQL statement out of the copy book and put it in the program.

Or, stop using the precompile and just do the compile with the DB2 option.

Or, talk to your co-workers about how to resolve the issue and follow their advice.

Note that your use of Changeman makes no difference -- if you don't like how it is working, you need to work with your site support group to change it.

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Tue Nov 11, 2014 5:53 pm
by Anuj Dhawan
Sangitha wrote:
Anuj Dhawan wrote:Along with what Nic has said, I'd also like to know what "compiling tool" are you using to compile your program?
I'm using chaneman for this.
If it is so - I'd make an educated guess that you're not telling the changeman that you're compiling a COBOL-DB2 program. To do that, from a distant memory, on some changeman panel, while compiling, you've to mention 'Y' to tell changeman to include 'pre-compiler' step in the underlying compile JCL that changeman will generate.

Having said all that, suggest - you ask around at your shop about this.

Re: IGYPS0225-S An "EXEC SQL" statement was found.

Posted: Fri Dec 26, 2014 2:12 pm
by Sangitha
Thanks all.

I was missing to tryn the 'pre-compiler' option as Yes. Making it "Y" has resolved the problem.