Page 1 of 1

Length Error in Get Container for variable length data

PostPosted: Tue Dec 03, 2013 10:56 pm
by nehaas427
Hi.

I am getting CICS RESP = 22 and CICS RESP2 =11 while 'GET CONTAINER' operation.

Request Container copybook:

01 WS-REQ-INPUT
05 WS-INLENGTH PIC S9(04) COMP.
05 WS-INDATA PIC X(01) OCCURS 1 TO 128 TIMES DEPENDING ON WS-INLENGTH.

I am passing below data in input file:
000812345678

The 'Get Container' is somehow reading the static data(ws-inlength) and not variable data (ws-indata).
Does FLENGTH support determining length of variable data?

Re: Length Error in Get Container for variable length data

PostPosted: Wed Dec 04, 2013 12:01 am
by Robert Sample
FLENGTH is a FULLWORD value -- PIC S9(08) COMP, not PIC S9(04) COMP (which is half a word). As long as you don't have the parameters being passed correctly, anything could result.

Re: Length Error in Get Container for variable length data

PostPosted: Wed Dec 04, 2013 12:19 am
by nehaas427
Yes Flength is full Word..

EXEC CICS
GET CONTAINER(WC-REQ-CONTAINER)
INTO(WS-REQ-CONTAINER)
FLENGTH(LENGTH OF WS-REQ-CONTAINER)
.
.
END-EXEC

Here Flength will capture the maximum length of input container i.e. 4 + 128 = 132 (WS-INLENGTH + WS-INDATA)..
But since I am passing data for 4 + 8 = 12 bytes.. Would it be a problem.?

Re: Length Error in Get Container for variable length data

PostPosted: Wed Dec 04, 2013 12:26 am
by nehaas427
Also, I have defined WS-INLENGTH as S9(04) comp... This will determine the length of WS-INDATA in request container. We can say WS-INDATA is just another variable defined in input area, its not the whole input area..

On the other hand, FLENGTH determines the maximum length of whole input area passed (WS-INLENGTH + WS-INDATA in my case).
So how does FLENGTH is affected by WS-INLENGTH S(04) comp. ?

In other words, suppose my input copybook has 3 variables X,Y, and Z. So, FLENGTH should capture the total length of X,Y,Z. It should not be affected by what relation X,Y,Z hold with each other.

Let me know if my understanding is incorrect.

Re: Length Error in Get Container for variable length data

PostPosted: Wed Dec 04, 2013 2:17 am
by Robert Sample
One thing to be aware of is that variable-length variables in WORKING-STORAGE are NOT variable length. COBOL sets the length of such variables to the MAXIMUM value because the variable can be any length up to the maximum. Hence using LENGTH OF <working-storage variable> means you do not have variable length data, but fixed length (fixed to the maximum size of the variable). I suspect either the FLENGTH issue or the variable-length / fixed length issue is causing your LENGERR.

If your length is PIC S9(04) COMP and you use FLENGTH in your program, CICS will take the two bytes of your length variable PLUS the next two bytes (whatever they are) for the length. This is not likely to produce results you want.

It sounds like you need to do some debugging to see how long your data is and how long CICS considers your data to be.

Re: Length Error in Get Container for variable length data

PostPosted: Wed Dec 04, 2013 11:06 am
by nehaas427
Thanks Robert for your inputs..

I will try to Expedite the program.