MainframeKit

LENGERR

DFHRESP(LENGERR) = 22CICS RESP CONDITION

A length is wrong: data too long for the area, or a length value that is not allowed.

MOST LIKELY

The receiving area or LENGTH value is smaller than the data.

FIRST CHECK

Capture RESP2 to see which length is wrong.

TRY IT ▸

MainframeKit assistant

What it means

LENGERR is raised when a length passed to or returned by a command does not fit. On READQ TS with INTO it means the stored item is longer than the LENGTH you gave; on LINK it covers bad COMMAREA, DATALENGTH or INPUTMSG lengths (see RESP2).

The data may be cut short, so do not trust the result without checking.

Typical causes

  • The receiving area or LENGTH value is smaller than the data.
  • A COMMAREA length that is negative or too large.
  • DATALENGTH larger than LENGTH on LINK.
  • Record length that does not match the queue or data set definition.

How to fix it

  1. Capture RESP2 to see which length is wrong.
  2. Make the receiving area big enough, or use SET instead of INTO where suitable.
  3. Check the lengths moved into LENGTH and DATALENGTH before the call.
  4. Code RESP (and RESP2) on the command and test the value with DFHRESP.

Example

Illustrative only; names and values are invented.

EXEC CICS READQ TS QUEUE('TSQ1') INTO(WS-ITEM) LENGTH(WS-LEN)
     RESP(WS-RESP) END-EXEC