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
- Capture RESP2 to see which length is wrong.
- Make the receiving area big enough, or use SET instead of INTO where suitable.
- Check the lengths moved into LENGTH and DATALENGTH before the call.
- 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