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

Db2 Troubleshooting


SQLCODE -302 input value too large

SQLCODE -302: input value too large — a host variable value does not fit the column.

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

  • CHAR host variable longer than the column.
  • Decimal value with more digits than the column allows.

How to diagnose

  • Compare host variable PIC/length with the column definition.
  • Display the offending value.

How to fix it

  • Enlarge the column or truncate/validate the input.
  • Fix the host variable definition to match.

Example: Match host variables to columns

* 01 WS-NAME PIC X(30). -- must fit the CHAR(30) column * Mismatched lengths cause -302.

Compare the DCLGEN with your working storage.

Interview tip

  • Q: How would you troubleshoot a SQLCODE -302 input value too large 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