Question & Answer
Why is my transaction failing with a LENGERR for the COMMAREA of an EXEC CICS XCTL command when running on CICS TS 5.1 or higher? I have an application that does an XCTL with a specified length for the applications COMMAREA. When this transaction runs on CICS Transaction Server for z/OS (CICS TS) V5.1, the transaction fails and LENGERR is returned indicating that there is an problem with the length of the COMMAREA. The same programs ran successfully in CICS TS V4.2.
There is a change with CICS TS V5.1 that causes applications to get the LENGERR on an XCTL in situations where that same application does not get the LENGERR with CICS TS V4.2 or lower. Programs that were incorrect but worked prior to CICS 5.1, no longer work. The problem just wasn't detected. The section entitled Changes to the CICS application programming interface in the CICS TS V5.1 documentation describes this change.
When a communication area (COMMAREA) is used with an XCTL command, CICS® can now create the COMMAREA in 31-bit storage, rather than 24-bit storage, where appropriate, thus reducing use of 24-bit storage.
When XCTL is used, CICS ensures that any COMMAREA is addressable by the program that receives it, by creating the COMMAREA in an area that conforms to the addressing mode of the receiving program. If the receiver is AMODE(24), the COMMAREA is created below the 16 MB line, and if the receiver is AMODE(31), the COMMAREA is created above 16 MB but below 2 GB.
In earlier releases of CICS, the COMMAREA was always copied below the 16 MB line.
( Changes to the CICS application programming interface in the CICS TS V5.2 knowledge center )
This change makes it possible for the new copy of the COMMAREA to be allocated in storage immediately following (or near) the original COMMAREA. In prior releases, the new copy of the COMMAREA was always below the line on a XCTL so the 2 areas could not be contiguous or were less likely to be allocated near the same area of storage. Now that the COMMAREAs can be allocated close to each other, there can be a destructive overlap when CICS copies the data from one area to the other and the LENGTH supplied on the XCTL specifies a length bigger than the actual COMMAREA length. The destructive overlap leads to the LENGERR.
Short of fixing the program to ensure it owns all of the data being passed on the XCTL by specifying the correct LENGTH on the XTCL, the only thing I can think of to prevent this problem is to link the XCTL'd to program as AMODE(24). That will cause its COMMAREA copy to be below the line like it used to prior to CICS TS V5.1.
CICS/TS CICSTS CICS TS CICS Transaction Server
02 September 2015