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 -805

What SQLCODE -805 means

  • -805 means the DBRM or package was not found in the plan.
  • In short: the program is trying to run under a plan that does not know its SQL.
  • The first question to ask is always: is the plan name correct?

Why -805 happens

  • The program was compiled but never bound. No BIND step ran.
  • The RUN step names the wrong plan.
  • The DBRM is not in the DBRM library concatenation used by the BIND.
  • The plan was bound, but the program's DBRM was later replaced without rebinding.

Fixing -805

  • Bind the program's DBRM into the plan, or bind the package and include its collection in the plan.
  • Verify that the plan name in the RUN JCL matches the bound plan.
  • Re-run the BIND after every recompile that changes SQL.
  • Example BIND step:
    //BIND 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) ISOLATION(CS) END /*
  • The RUN step must then use the same plan: RUN PROGRAM(MYPROG) PLAN(MYPLAN).





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant