View previous topic :: View next topic
|
Author |
Message |
myselfsk15
New User
Joined: 25 Sep 2020 Posts: 4 Location: Australia
|
|
|
|
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 |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Maximum length of a COBOL Working Storage item is much greater than 32k. Look up “compiler limits” in the manual. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
myselfsk15
New User
Joined: 25 Sep 2020 Posts: 4 Location: Australia
|
|
|
|
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 |
|
|
myselfsk15
New User
Joined: 25 Sep 2020 Posts: 4 Location: Australia
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
myselfsk15
New User
Joined: 25 Sep 2020 Posts: 4 Location: Australia
|
|
|
|
Thank you Robert. Appreciate your help and direction. |
|
Back to top |
|
|
don.leahy
Active Member
Joined: 06 Jul 2010 Posts: 765 Location: Whitby, ON, Canada
|
|
|
|
Enterprise COBOL allows a WS item up to 999,999,999 bytes. Compiler limits are well documented in the Language Reference. |
|
Back to top |
|
|
|