Page 1 of 1

DB2 Precompile

PostPosted: Fri Jun 18, 2010 11:36 pm
by suruchi
What I have understood about DB2 precompiler is that it reads the source code and comments the SQL statement and replaces them with call to DB2. It checks SQL statement for syntax errors. Also Precompiler do not refer to DB2 catalog table.
I have been asked in an interview that how does Precompiler identifies SQL statement if DB2 catalog table is not refered?

Can anyone please explain me that how precompiler identifies SQL statement ?

Thanks

Re: DB2 Precompile

PostPosted: Fri Jun 18, 2010 11:42 pm
by dick scherrer
Hello and welcome to the forum,

Can anyone please explain me that how precompiler identifies SQL statement ?

Maybe:
EXEC SQL
.
thru
.
END-EXEC?

Re: DB2 Precompile

PostPosted: Fri Jun 18, 2010 11:52 pm
by suruchi
Thanks for the reply

I was doing more research on this and I found that precompiler does a basic syntax checking by referring DB2 DECLGEN
I am not sure if this is correct.


Thanks

Re: DB2 Precompile

PostPosted: Sat Jun 19, 2010 12:48 am
by dick scherrer
Hello,

Yes, this is also true. . . DCLGEN info is "include"d in w-s typically.

All of the sql statements are "wrapped" in "exec sql"/"end-exec".