Length Error in Get Container for variable length data



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

Length Error in Get Container for variable length data

Postby nehaas427 » Tue Dec 03, 2013 10:56 pm

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?
nehaas427
 
Posts: 4
Joined: Tue Nov 13, 2012 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length Error in Get Container for variable length data

Postby Robert Sample » Wed Dec 04, 2013 12:01 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Length Error in Get Container for variable length data

Postby nehaas427 » Wed Dec 04, 2013 12:19 am

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.?
nehaas427
 
Posts: 4
Joined: Tue Nov 13, 2012 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length Error in Get Container for variable length data

Postby nehaas427 » Wed Dec 04, 2013 12:26 am

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.
nehaas427
 
Posts: 4
Joined: Tue Nov 13, 2012 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Length Error in Get Container for variable length data

Postby Robert Sample » Wed Dec 04, 2013 2:17 am

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.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Length Error in Get Container for variable length data

Postby nehaas427 » Wed Dec 04, 2013 11:06 am

Thanks Robert for your inputs..

I will try to Expedite the program.
nehaas427
 
Posts: 4
Joined: Tue Nov 13, 2012 5:55 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CICS

 


  • Related topics
    Replies
    Views
    Last post