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

Read 4MB message and split into multiple 200 byte messages


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
myselfsk15

New User


Joined: 25 Sep 2020
Posts: 4
Location: Australia

PostPosted: Fri Sep 25, 2020 7:24 am
Reply with quote

Hi,
I have to read a message from MQ queue of length 4MB and then split into multiple fixed byte length of each 200 bytes.
All I know is after reading the message I should keep 4MB message in a COBOL working storage variable and its maximum length is 32KB.

Is there any way to handle this condition? If not in COBOL how else in Mainframe I can consume and split this big message from IBM MQ into multiple small messages in Mainframe?

Please advise.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Fri Sep 25, 2020 7:38 am
Reply with quote

Maximum length of a COBOL Working Storage item is much greater than 32k. Look up “compiler limits” in the manual.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Sep 25, 2020 5:56 pm
Reply with quote

How about doing GETMAIN and assign the pointer to a large space and then use it accordingly. Btw as said limits are greater than 32kb , and default mq messages length is 4MB so you would need to ask them if that’s really the case in real or change the message length to a realistic value.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Sep 25, 2020 6:37 pm
Reply with quote

Quote:
COBOL working storage variable and its maximum length is 32KB.
The ONLY time this is true is when you are working in CICS -- otherwise, depending upon your release of COBOL and addressing options, the maximum length can be anywhere from just over 134 million bytes to just under 2 gigabytes. If you're working in CICS, you need to explore the use of channels (assuming, of course, that your version is CICS is recent enough to support them) since channels are NOT limited by the 32K working storage limitation of CICS and the effective limit will be the available memory.

And if you're working in CICS, you should have mentioned that in your post -- you posted in the COBOL Programming topic which covers CICS and batch COBOL programs.
Back to top
View user's profile Send private message
myselfsk15

New User


Joined: 25 Sep 2020
Posts: 4
Location: Australia

PostPosted: Sun Sep 27, 2020 4:38 pm
Reply with quote

Robert Sample wrote:
Quote:
COBOL working storage variable and its maximum length is 32KB.
The ONLY time this is true is when you are working in CICS -- otherwise, depending upon your release of COBOL and addressing options, the maximum length can be anywhere from just over 134 million bytes to just under 2 gigabytes. If you're working in CICS, you need to explore the use of channels (assuming, of course, that your version is CICS is recent enough to support them) since channels are NOT limited by the 32K working storage limitation of CICS and the effective limit will be the available memory.

And if you're working in CICS, you should have mentioned that in your post -- you posted in the COBOL Programming topic which covers CICS and batch COBOL programs.



Hi Robert,

Yes, it is plain COBOL program, not CICS program.
Could you please share some insights of how can I read 4MB message from MQ and what compiler options I should set to big values (any sample code or examples..as I am amateur Mainframe programmer)?

Thanks a heaps.
SK
Back to top
View user's profile Send private message
myselfsk15

New User


Joined: 25 Sep 2020
Posts: 4
Location: Australia

PostPosted: Sun Sep 27, 2020 4:40 pm
Reply with quote

Rohit Umarjikar wrote:
How about doing GETMAIN and assign the pointer to a large space and then use it accordingly. Btw as said limits are greater than 32kb , and default mq messages length is 4MB so you would need to ask them if that’s really the case in real or change the message length to a realistic value.



Hi Rohit,

I am not across GETMAIN. could you brief some more details around this option on how to use it to store 4MB size data in a working storage variable to write in a flat file later after splitting it into 170 bytes length multiple fixed messages.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Sun Sep 27, 2020 6:07 pm
Reply with quote

You have heard of manuals have you? Try reading them and try some coding - you will learn more that way. Come back when you have a problem with your code.
Remember - this is a forum for experts (that is the title). There is a forum for beginners.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon Sep 28, 2020 3:46 am
Reply with quote

Quote:
Could you please share some insights of how can I read 4MB message from MQ and what compiler options I should set to big values (any sample code or examples..as I am amateur Mainframe programmer)?
I have no experience with MQ and hence cannot provide you with any information about it or how to read a 4 MB message. There are no compiler options required to use large memory structures in COBOL. I have written an XML parsing program before that used a 10-million-byte variable to contain the XML text. It was defined as
Code:
01  WS-XML-SOURCE     PIC X(10000000).
and there were absolutely no problems compiling or running the program.

Based on what you've posted so far, you need to start posting in Beginners and Students Forum instead of here. This forum is for experts and not really designed for someone who doesn't know how to read an MQ message nor how to use the manuals to answer their own questions.
Back to top
View user's profile Send private message
myselfsk15

New User


Joined: 25 Sep 2020
Posts: 4
Location: Australia

PostPosted: Mon Sep 28, 2020 6:34 am
Reply with quote

Thank you Robert. Appreciate your help and direction.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Tue Sep 29, 2020 7:46 am
Reply with quote

Enterprise COBOL allows a WS item up to 999,999,999 bytes. Compiler limits are well documented in the Language Reference.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts combine multiple unique records into ... DFSORT/ICETOOL 2
No new posts omegamon for cics -UNSUPPORTED ENVIRO... CICS 2
No new posts SORT JCL to merge multiple tow into s... DFSORT/ICETOOL 6
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top