Page 1 of 1

DB2 precompile and compile

PostPosted: Fri Apr 11, 2014 9:51 am
by nitinjohari
hi,

If I am making the changes only to a cobol portion of a cobol-db2 program, do I need to precompile that program again? If not, then how would I be able to compile it? I tried to compile the program, but it gave me compilation errors saying that "EXEC SQL statement was found, but the compiler option was disabled". Ideally, I should be allowed to compile the new source and use the old DBRM, because I have not made any changes in SQL part of the program.

Is there something that I am missing over here?

Re: DB2 precompile and compile

PostPosted: Fri Apr 11, 2014 12:16 pm
by BillyBoyo
When changing your program, you should re-compile it in exactly the same way as it was previously, even if you have only changed COBOL code. If you try anything else, it will not work. You still have non-COBOL source statements which need to be processed, even though you have not changed them.

Re: DB2 precompile and compile

PostPosted: Fri Apr 11, 2014 6:53 pm
by Terry Heinze
If I remember correctly, the DBRM is part of the resultant load module, so the source program MUST go through the preprocess step to include the embedded SQL. In addition, your changed COBOL code MAY cause DB2 to choose a different path for your SQL.

Re: DB2 precompile and compile

PostPosted: Sat Apr 12, 2014 9:40 pm
by nitinjohari
Thanks Billy and Terry, that was helpful. Though I did try out the scenario and faced a timestamp error when i tried using the older dbrm, clearly because the con token of load module changed when i compiled it the second time. So, that sums it up that "if there is a change in source (whether cobol or SQL), precompile, compile,linkedit and bind are requried again".

Re: DB2 precompile and compile

PostPosted: Sun Apr 13, 2014 10:47 pm
by dick scherrer
Hello and welcome of the forum,

What you should take away from this topic is More importand than the technical info . . .

You should NOT create your own compile/link/bind process. You SHOULD use the standard process for your organization.

Well managed organizations do not allow people to build their own processes like this one.

Re: DB2 precompile and compile

PostPosted: Sun Apr 13, 2014 11:16 pm
by Terry Heinze
Good point, dick.

Re: DB2 precompile and compile

PostPosted: Mon Apr 14, 2014 12:05 am
by nitinjohari
Thanks Dick.

I do understand that, but i was just trying the scenario out. The process are definitely well defined, but i was just curious to try this out.

Re: DB2 precompile and compile

PostPosted: Mon Apr 14, 2014 4:00 am
by dick scherrer
You're welcome.

Learning is a good thing!

Just make sure that this is OK for you to do and is approved by those responsible for supporting the environment.

A mistake could corrupt components used for the experiment.