DB2 Precompiler Option : LEVEL (A way to avoid binding)

If there is any change in your existing DB2 Application program what are the steps you follow to finally put it back in production ??

- You make the necessary changes to program as per the requirement.

- You compile and link edit your program to create new LOAD MODULE

- You bind the latest DBRM to PLAN/PACKAGE

- You run the program by using current PLAN and LOAD MODULE.

- Finally you deliver your correct LOAD MODULE and Source program to
  production libraries after successful testing.

The third step i mentioned here about binding, is it necessary if the SQL within my program doesn't change. Logically speaking it should not because my DBRM remains the same , so should my PLAN.

But it's not the case ,why ? because when you compile your program after the changes, the DB2 precompiler will place some new consistency token in your DBRM as well as the source program and if you don't bind the DBRM then your plan will have the previous consistency token when it was last time bind while your load module have the latest one and you will get the consistency token mismatch ( For more detail refer this.)

So you need to bind your DBRM again into PLAN/PACKAGE even though the SQL statement in your program remain unchanged.

Is it not overhead?? Yes it is. Then can i have some provision like when there is change in my COBOL program only and the SQL statement remain unchanged i should avoid this binding ??? 

Yes there is.The DB2 Precompiler option LEVEL can be use to avoid binding in such case.

Let's see how it works.

The program level defines the level for a particular module. This information is
stored in the consistency token, which is in an internal DB2 format. Overriding the program level in the consistency token is possible

To override the construction of the consistency token by DB2, use the LEVEL (aaaa) option. DB2 uses the value that you choose for aaaa to generate the consistency token.

aaaa is any alphanumeric value of up to seven characters.

You can omit the suboption (aaaa). The resulting consistency token is blank.

 For COBOL, you need to specify the suboption.

The LEVEL option can be abbreviated to L.

However  the DSNH CLIST and the DB2I panels do not support this option .

After providing this Level Option in DB2 Precompilation step. You just need to follow the following things.

-   Change the source code (but not the SQL statements).

-   Compile and link-edit the changed program.

-   Run the application without rebinding a plan or package.

A word of advice :

Before making use of this option, please double check that you are NOT changing any SQL statement in your program else you will not get the expected results.


ankoo said...

Good work!

Shivankoo said...

I have opened this website twice and both the times I'hv learnt new things,believe me its the best of the best DB2 information and well explained!

Post a Comment