Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 11: DB2 SQLCODE, SQLSTATE and Error Handling


SQLCODE -818

What SQLCODE -818 means

  • -818 means the timestamp of the load module does not match the timestamp in the plan.
  • DB2 stamps the DBRM at precompile time. The plan records that stamp at bind time.
  • At runtime DB2 compares the two. A mismatch means the running program is not the one the plan was built for.

Why -818 happens

  • The program was recompiled, creating a new DBRM timestamp, but the plan was not rebound.
  • The plan was rebound from an old DBRM library while a new load module is in place.
  • The wrong DBRM library was used in the BIND step.

Fixing -818

  • Rebind the plan from the current DBRM library after every recompile.
  • Keep the compile, bind and run steps in the right order.
  • Verify that the BIND used the same DBRM data set the compile produced.
  • Example rebind step - run this after every recompile:
    //REBIND EXEC PGM=IKJEFT01,DYNAMNBR=20 //DBRMLIB DD DSN=MY.DBRMLIB.DATA,DISP=SHR //SYSTSPRT DD SYSOUT=* //SYSTSIN DD * DSN SYSTEM(DB2T) BIND PLAN(MYPLAN) MEMBER(MYPROG) - LIBRARY('MY.DBRMLIB.DATA') - ACTION(REPLACE) END /*





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant