Where and how to check for Consistency token

As a DB2 programmer you know what consistency token is and why DB2 uses it . If not, those famous SQLCODE -805 OR -818 error will make you know what it is. So let's not get into that.

The real question is where and how I can view this unique token generated by DB2 so that I can verify that it is in sync or if not in sync then who is at the fault and how to rectify it.

So After DB2 precompiler generates this unique consistency token, it will placed and available in OBJLIB,DBRMLIB and LOAD Module library and get matched against IBM DB2 catalog table SYSIBM.SYSPACKAGE at run time.

Checking Consistency token in DBRMLIB








Open DBRMLIB library, Put command "HEX ON "  on command line and look at the position 25 to 32 at the very first record.That's your Consistency token ,

So here 19C173C91588C612 is the hex value of your contoken.

Checking Consistency token in LOADMODULE

So this token we found in DBRM lib will be present in Load module. Well , how to find it?

Unlike ,DBRMLIB there is no specific location in Load library where this token can be found.

So get the token we found in DBRMLIB ,19C173C91588C612 

Now divide into half and reverse it  that is 1588C61219C173C9.

Now Open Load library and put command "F X'1588C61219C173C9'". That's how you check it here.

Checking Consistency token in SYSIBM.SYSPACKAGE.

This is very straight forward simply run the below query.


SELECT (
                 SUBSTR(HEX(A.CONTOKEN),9,8) || SUBSTR(HEX(A.CONTOKEN),1,8 )
                
               ) AS CONTOKEN  
 FROM SYSIBM.SYSPACKAGE A
 WHERE NAME IN ('ABCD1234')


**ABCD1234 is your program name.

Hope you got something out of this post.
 

 

No comments:

Post a Comment