Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Read 4MB message and split into multiple 200 byte messages

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Read 4MB message and split into multiple 200 byte messages
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: 693
Location: Whitby, ON, Canada

PostPosted: Fri Sep 25, 2020 7:38 am    Post subject:
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: 2492
Location: NY,USA

PostPosted: Fri Sep 25, 2020 5:56 pm    Post subject:
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: 8567
Location: Dubuque, Iowa, USA

PostPosted: Fri Sep 25, 2020 6:37 pm    Post subject: Reply to: Read 4MB message and split into multiple 200 byte messages
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    Post subject: Re: Reply to: Read 4MB message and split into multiple 200 byte messages
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    Post subject:
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: 2422
Location: Hampshire, UK

PostPosted: Sun Sep 27, 2020 6:07 pm    Post subject: Reply to: Read 4MB message and split into multiple 200 byte messages
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: 8567
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 28, 2020 3:46 am    Post subject: Reply to: Read 4MB message and split into multiple 200 byte messages
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    Post subject: Re: Reply to: Read 4MB message and split into multiple 200 byte messages
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: 693
Location: Whitby, ON, Canada

PostPosted: Tue Sep 29, 2020 7:46 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need to read duplicate rows from tabl... Poha Eater DB2 2 Wed Oct 07, 2020 11:08 pm
No new posts Creating a single-record file with CO... Joerg.Findeisen DFSORT/ICETOOL 8 Tue Oct 06, 2020 8:19 pm
No new posts how to read accounting information in... jzhardy COBOL Programming 1 Mon Sep 21, 2020 9:57 am
No new posts Dynamically read input files using BP... Srinivas B COBOL Programming 20 Sat Sep 05, 2020 1:48 pm
No new posts EIBRESP=16 and EIBRESP2=25 while doi... sancraig16 CICS 2 Thu Sep 03, 2020 2:53 am

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us