Simple Mainframe Universe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Db2 Troubleshooting


SQLCODE -220 column definition mismatch

SQLCODE -220: column definition mismatch — the value does not match the column definition.

What it means

  • After every EXEC SQL, DB2 returns a SQLCODE: 0 means success, +100 means no row found, and negative values mean an error.

Common causes

  • Inserting a string into a numeric column.
  • Length or type mismatch.

How to diagnose

  • Compare the value type with the column type.
  • Check DCLGEN vs working storage.

How to fix it

  • Convert the value or fix the column/host definition.

Example: Align types end to end

* Host variable, column, and input must agree on type. * DCLGEN is the reference.

Type mismatches surface as -220.

Interview tip

  • Q: How would you troubleshoot a SQLCODE -220 column definition mismatch in production?
  • A: I would check the SQLCODE and SQLERRM immediately after the failing statement, reproduce in SPUFI, then apply the specific fix.

Prevention checklist

  • Always check SQLCODE after every EXEC SQL statement.
  • Log the SQLCODE, SQLSTATE and failing statement for support.




© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant