RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE -311 - Invalid Length Control Field mean in RPG (IBM i / AS/400)?
A varying-length host variable's length subfield held a negative value or a value larger than the variable's declared maximum, so SQL couldn't determine how much data to move.
A varying-length host variable's length subfield held a negative value or a value larger than the variable's declared maximum, so SQL couldn't determine how much data to move.
RPG's VARYING keyword normally manages this length field for you, so check for manually built SQLDAs or API calls that set it incorrectly, and never leave that subfield uninitialized before an INSERT or UPDATE.