IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Clarification about FLENGTH in Channels and Containers


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Thu Nov 26, 2009 5:13 pm
Reply with quote

Hi all,

I have program-A which currently has following copybooks in the Input Container(INP-CONTAINER)

01 INP-CONTAINER-DATA
Copybook A
Copybook B

The Program A links to Program B passing the input container data using same channel.

Program B is a generic module and can include only Copybook A.

In Program B the input container declaration is as follows,

01 INP-CONTAINER-DATA
Copybook A

Now when i issue GET Container, I'm getting LENGTHERR as copybook B is not included in program B.

GET Container syntax i used,

EXEC CICS
GET
CONTAINER (INP-CONTAINER)
CHANNEL (WS-CHANNEL)
INTO (INP-CONTAINER-DATA)
FLENGTH (LENGTH OF INP-CONTAINER-DATA)
RESP (WS-CICS-RESP)
RESP2 (WS-CICS-RESP2)
END-EXEC

Can any one please help me in sorting out this issue?

I have read books to understand about the concept of FLENGTH. I'm new to channels and containers. i couldnt understand.

Please help me.

Thanks,
Suma
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 26, 2009 5:34 pm
Reply with quote

The CICS Application Programming Reference (manuals link at the top of the page) is pretty clear:
Quote:
FLENGTH(data-area)
As an input field, FLENGTH specifies, as a fullword binary value, the length of the data to be read. As an output field, FLENGTH returns the length of the data in the container. Whether FLENGTH is an input or an output field depends on which of the INTO, SET, or NODATA options you specify.

INTO option
specified FLENGTH is both an input and an output field.

On input, FLENGTH specifies the maximum length of the data that the program accepts. If the value specified is less than zero, zero is assumed. If the length of the data exceeds the value specified, the data is truncated to that value and the LENGERR condition occurs.

FLENGTH need not be specified if the length can be generated by the compiler from the INTO variable. If you specify both INTO and FLENGTH, FLENGTH specifies the maximum length of the data that the program accepts.

On output (that is, on completion of the retrieval operation) CICS sets the data area, if specified, to the actual length of the data in the container. If the container holds character data that has been converted from one CCSID to another, this is the length of the data after conversion.
Since your code has INTO, FLENGTH is being treated as an input field. The length of data being passed is longer than the length you set in FLENGTH, so you get the LENGERR condition. So you ignore the length error (or whatever you want to do in this case), and the program continues -- it cannot use any of the data in what you called copybook B, but so what? It obviously does not need that data.
Back to top
View user's profile Send private message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Thu Nov 26, 2009 5:54 pm
Reply with quote

Thanks Robert.

Is there any other option available to get rid of LENGTHERR in the same scenario?
Back to top
View user's profile Send private message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Thu Nov 26, 2009 6:02 pm
Reply with quote

FLENGTH(data-area)
As an input field, FLENGTH specifies, as a fullword binary value, the length of the data to be read

As specified in the Manual, FLENGTH specifies the length of the data to be read.

In my case, i have said FLENGTH (LENGTH OF INP-CONTAINER-DATA) . In program B, the length of INP-CONTAINER-DATA is nothing but the length of Copybook A alone.
In the 'INTO' also i have specified only the Copybook A contents. Then why it is giving me LENGTHERR?

This is what i couldnt understand.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 26, 2009 6:13 pm
Reply with quote

From my manual post earlier (emphasis added):
Quote:
If the length of the data exceeds the value specified, the data is truncated to that value and the LENGERR condition occurs.
The actual length of the container data is longer than the length you specified in FLENGTH. This causes the LENGERR condition. You can either specify a longer length in FLENGTH, or you can handle the LENGERR condition. CICS can tell that the length of data in the container is longer than your FLENGTH value, so your only other choice would be to not have so much data put in the container.

In your program B, you say the length is the length of INP-CONTAINER-AREA but CICS could tell that the data written (by program A, I assume) was actually longer than you specified. As long as your program B does not reflect the actual, true length of the data written, it will continue to get LENGERR conditions.
Back to top
View user's profile Send private message
suma_infy

New User


Joined: 03 Oct 2008
Posts: 25
Location: chennai

PostPosted: Thu Nov 26, 2009 6:26 pm
Reply with quote

Thanks a lot Robert.

As u said, "You can either specify a longer length in FLENGTH, or you can handle the LENGERR condition"

If i specify Longer length in the Flength, even then do i get LENGTHERR?

Is there any provision to give maximum length(say for eg. FLENGTH (MAX)) in FLENGTH ?

Thanks in advance!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 26, 2009 6:41 pm
Reply with quote

You could try setting FLENGTH to 16777215. LENGERR will continue to occur as long as the length you set is less than the actual length of the container.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts FCP channels for z VM and LINUX All Other Mainframe Topics 0
No new posts .Net support for CICS containers? CICS 0
No new posts How to get complete URL from CICS Con... CICS 1
No new posts Disappearing Channels CICS 9
No new posts COMMAREA and CHANNELS CICS 4
Search our Forums:

Back to Top