If we remember during precompilation process, the SQL part and COBOL part are separated.While doing so, compiler engraves a time stamp to each part, so that later they can identify each other. at run time. This time stamp is what we call Contoken or consistency token
We get SQL code of -818 when the Consistency Token placed by DB2 precompilation Step does not match between the DBRM and the Load Module.
80N or -805 is what we get when the DBRM or Package is not found in Plan which we used in JCL.
Steps to find out the contoken and verify if both are same??
We can go to QMF or run the below query
SELECT NAME, HEX(CONTOKEN), BINDTIME,PDSNAME
FROM SYSIBM.SYSPACKAGE WHERE
ORDER BY BINDTIME DESC
We fetch the HEX value for the contoken.Otherwise we wont be able to see the value,if fetched normally.
This Fetches the program-name, its contoken, bind time and the DBRM Library order by latest bind time.
we can get the same Contoken (with out using the above query also) by looking into the DBRM library for the program.
Open the DBRM Library and give the command HEX ON
Position of contoken in DBRMLIB
Look for 25 to 32nd position in the first line. That will show the contoken.
Next Step 2:
Remember the Date and Time part of Contoken are swapped in Loadlib, you need to split the above contoken into two halves of 8 characters each and swap their positions like below:
Taking the above example, contokens are
1st Half : 18DAE169
2nd Half: 1F0420A5
Swapping and joining them results in
Now go to the LOAD MODULE library and search for it like
You should be able to see this. Else There is a contoken mismatch.Rebind again or recompile to get rid of this freaking problem. -:)
Note: F x 'search-string' . Here x implies the search string in quotes is hex value.