Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Clarification about FLENGTH in Channels and Containers

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Clarification about FLENGTH in Channels and Containers
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Thu Nov 26, 2009 5:34 pm    Post subject:
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    Post subject: Reply to: Clarification about FLENGTH in Channels and Contai
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    Post subject: Reply to: Clarification about FLENGTH in Channels and Contai
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Thu Nov 26, 2009 6:13 pm    Post subject:
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    Post subject: Reply to: Clarification about FLENGTH in Channels and Contai
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Thu Nov 26, 2009 6:41 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts COMMAREA and CHANNELS menonkiran CICS 4 Tue Apr 04, 2017 8:14 am
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Need clarification of VSAM FCT and DF... pkmurali CICS 15 Sun Apr 10, 2016 1:06 am
No new posts Porting to Channels and Containers yugendran CICS 3 Thu Nov 12, 2015 1:02 pm
No new posts issues with memory in programs with c... sivakumar.karthik CICS 4 Thu Aug 13, 2015 8:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us