ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » Using the MQI from RPG and message size limits

Post new topic  Reply to topic
 Using the MQI from RPG and message size limits « View previous topic :: View next topic » 
Author Message
zpat
PostPosted: Tue May 05, 2009 12:10 am    Post subject: Using the MQI from RPG and message size limits Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

One of our RPG (AS/400) programmers tells me that a single RPG variable has a max size of 64kb.

What is the recommended way to MQGET a MQ message longer than 64 KB in RPG (e.g. 4 MB)?

Presumably using an array or structure - can someone please clarify this?
Back to top
View user's profile Send private message
rtsujimoto
PostPosted: Tue May 05, 2009 7:58 am    Post subject: Reply with quote

Centurion

Joined: 16 Jun 2004
Posts: 119
Location: Lake Success, NY

Here's an old posting that discusses this:

Hi all,

Of course it's possible to use larger fields than 32k in ILE/RPG. You must
use a trick that might not be known to everyone. The trick is to create an
array that is large enough to hold the data. In the sample that i attach
with my reply the array can hold messages up to 4Mb. The sample also
include a call to a c function (memmove) that make it easier to manipulate
the data in the large array. The sample is not complete. It has been
taken out of a larger program that act as a standard MQ adapter in our
back end systems.

contact admin Nyberg
Electrolux IT Solutions - Sweden

Nick Denning <nick.denning@STRATEGICTHOUGHT.CO.UK> wrote:

>Guys,
>
>Potentially a neat way to help address this might be to specify the maximum
>message length for the queue to be 32k (or indeed what ever the maximum
>length is that you wish to deal with). If you then set the message to
>segment if necessary on MQPUT and MQGET to wait until all segments are
>available, but still only dequeue them manually then you probably get the
>best of all worlds:
>
>Minimim complexity in any applications writing to the queue outside RPG as
>the segmentation is done for you, minimum complexity in the applications
>reading from the queue that are not written in RPG as they can use the
>automatic assembly mechanism, but scope for the RPG program to retrieve each
>of the segments separately as Rakesh has described below.
>
>I have code that does all this:
>
>Put a message that segments itself if required:
>
> pMsgDesc->MsgFlags |= MQMF_SEGMENTATION_ALLOWED;
> pMsgDesc->Version = MQMD_VERSION_2;
>
>put a specific segment:
>
> pMsgDesc->MsgFlags = MQMF_SEGMENT;
> pMsgDesc->Version = MQMD_VERSION_2;
>
>put the last segment:
>
> pMsgDesc->Version = MQMD_VERSION_2;
> pMsgDesc->MsgFlags = MQMF_LAST_SEGMENT;
>
>
>Get a segmented message in one go:
>
> pGetMsgOpts->Options |= MQGMO_COMPLETE_MSG;
> pMsgDesc->Version = MQMD_VERSION_2;
>
>Retrieve a segmented message in individual segments:
>
> GetMsgOpts.Options |= MQGMO_ALL_SEGMENTS_AVAILABLE | MQGMO_LOGICAL_ORDER;
> MsgDesc.Version = MQMD_VERSION_2;
> GetMsgOpts.Version = MQGMO_VERSION_2;
>
> while ( GetMsgOpts.SegmentStatus == MQSS_SEGMENT )
>
>Alternatively you have the logical order thing that you can play. Sorry I
>am a C programmer so you will have to find the equivalent in RPG. However
>its pretty straight forward and took me only about half a day to get working
>from the manuals.
>
>nick
>
>-----Original Message-----
>From: Rakesh Jaiswal [mailto:rakesh.jaiswal@WIPRO.COM]
>Sent: 05 April 2002 07:10
>To: MQSERIES@AKH-Wien.AC.AT
>Subject: Re: RPG, AS/400, and mqget
>
>
>Even i am not RPG programmer but I am handling MQ on AS/400 .One of my
>colleague told that it is RPG Language limitation .it is not at all MQ
>limitation. In ILE-RPG Programming language a variable can store max 32k
>byte only.
>We are also facing one problem due to same. When we are transfering image
>file bytes(>32K) then a RPG program that is getting this message is not
>able to receive it in a variable & store in DB2. Now i am trying to send
>data in segments with each segment less then 32k.
>one guy told me that IFS can handle it but couldn't got much info about it.
>If any RGP programmers know how to handle >32k data pls give me some clue.
>
>Regards,
>Rakesh
>
>----- Original Message -----
>From: "Stefan Sievert" <stefansievert@HOTMAIL.COM>
>To: <MQSERIES@AKH-WIEN.AC.AT>
>Sent: Friday, April 05, 2002 2:51 AM
>Subject: Re: RPG, AS/400, and mqget
>
>
>> Andy,
>> I am not experienced with programming on the AS/400, but your question
>made
>> me curious, because that sounds like a limitation that would be too
>> restrictive; so I read the MQSeries for AS/400 APR manual. On the
>> description of the MQGET call (the BUFLEN parameter) it says:
>>
Quote:

>> Note: The length of the longest message that it is possible to read from
>the
>> queue is given by the MaxMsgLength local queue attribute
>>

>> There is no mention of any 32K limit that would apply. However, Usage note
>8
>> states:
>>
Quote:

>> The BUFFER parameter shown in the RPG programming example is declared as
>> a string; this restricts the maximum length of the parameter to 256 bytes.
>> If a larger buffer is required, the parameter should be declared instead
>as
>> a structure, or as a field in a physical file.
>> Declaring the parameter as a structure increases the maximum length
>possible
>> to 9999 bytes, while declaring the parameter as a field in a physical file
>> increases the maximum length possible to approximately 32K bytes.
>>

>> These two statements seem to be contradictory to me, but I am not sure if
>> the latter only refers to the specific implementation of the programming
>> example.
>> Has your developer actually tried to retrieve a message larger than 32K
>and,
>> if yes, what happened? Any errors/warnings with associated reason codes?
>> Maybe some more seasoned RPG programmer can comment further.
>> Cheers,
>> Stefan
>>
>>
>> >From: "Saar, Andrew" <ASaar@GAPAC.COM>
>> >Reply-To: MQSeries List <MQSERIES@AKH-Wien.AC.AT>
>> >To: MQSERIES@AKH-Wien.AC.AT
>> >Subject: RPG, AS/400, and mqget
>> >Date: Thu, 4 Apr 2002 14:00:13 -0500
>> >
>> >We have a developer who is working on an AS/400 where we have a 5.1 queue
>> >manager. He is programming in RPG and is trying to do an MQGet from a
>> >local queue. Very basic. The problem is that the messages are about
>> >100-250K. The programmer is telling me that he cannot pull messages that
>> >are larger than 32K because that is the largest his buffer parameter on
>the
>> >MQGet call will go. I don't understand how this can be possible. I
>looked
>> >through the docs and it appears he's right, but I just refuse to believe
>> >that RPG on AS/400 accessing MQ could be so crippled. Can anyone help?
>> >
>> >Thank you,
>> >Andrew
>>
>>
>> _________________________________________________________________
>> MSN Photos is the easiest way to share and print your photos:
>> http://photos.msn.com/support/worldwide.aspx
>>
>> Instructions for managing your mailing list subscription are provided in
>> the Listserv General Users Guide available at http://www.lsoft.com
>> Archive: http://vm.akh-wien.ac.at/MQSeries.archive
>
>
>
>*************************************************************************
>This message contains privileged and confidential information intended
>only for the use of the recipient named above. Its contents do not
>constitute a commitment by Strategic Thought Limited ("Strategic
>Thought") unless separately endorsed by an authorised representative
>of Strategic Thought.
>
>Any use, dissemination, distribution, reproduction or unauthorised
>disclosure of this message is prohibited. If you receive this message
>in error, please notify the sender immediately and delete it from your
>computer systems.
>
>Any views expressed in this message are those of the individual sender
>and may not necessarily reflect those of Strategic Thought.
>
>Strategic Thought believes this e-mail and any attachments to be virus
>free. However, the recipient is responsible for ensuring it is virus
>free and Strategic Thought do not accept any responsibility for any
>loss or damage howsoever caused from use of this e-mail, attachments
>or contents.
>*************************************************************************
>
>Instructions for managing your mailing list subscription are provided in
>the Listserv General Users Guide available at http://www.lsoft.com
>Archive: http://vm.akh-wien.ac.at/MQSeries.archive
>


__________________________________________________________________
Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/
*=====================================================================
* Standalone field definitions.
*=====================================================================
D BufLen S 10i 0
D HObj S 10i 0
D MsgLen S 10i 0
D MQOpts S 10i 0
D QMName S 48a
D Rcode S 4s 0
D W0_WaitC DS 2
D W0_Wait 2s 0

D MQReturnCodes DS
* Completion codes
D CompCode 10i 0
D MQCode 10i 0
D OpenCode 10i 0
* Reasons
D ConnReason 10i 0
D MQReason 10i 0

*---------------------------------------------------------------------
* Prototypes for C functions.
*---------------------------------------------------------------------
D memmove pr 8f extproc('memmove')
D Target * options(*string) value
D Source * options(*string) value
D BufferLen 10i 0 value

*=====================================================================
* Buffer declarations.
*=====================================================================
D BufferLenIn S 9 0
D BufferIn S 1024a Dim(4000) Based(PtrBufIn)
D PtrBufIn S *


C Alloc W0_LenIn PtrBufIn
C ExSr MQGetMsg
* Normal application code goes here

* Free the storage used for the communication buffers.
C DeAlloc PtrBufIn
C Eval *InLr = *On
*=====================================================================
* Get message from source queue:
*=====================================================================
C MQGetMsg BegSr

C Eval GMOPT = GMNONE

* Length of buffer available
C Eval BufLen = W0_LenIn

* MsgId and CorrelId are selectors that must be cleared
* to get messages in sequence, and they are set each MQGET
C Eval MDMID = MINONE
C Eval MDCID = CINONE


C CallP MQGET(HConn : Hobj : MQMD : MQGMO :
C BufLen : PtrBufIn : MsgLen : CompCode :
C MQReason)

* Set BUFLEN to what was received
C If MsgLen < BufLen
C Eval BufLen = MsgLen
C Eval BufferLenIn = MsgLen
C EndIf

* Report reason, if any
C Select
C When MQReason = RCNONE
* Specific text for "no more messages"
C When MQReason = RC2033
C Other
* Otherwise say "MQGET ended with reason code ...."
C Eval CName = 'MQGET '
C ExSr PrtErr
C EndSl

C CallP memmove(%addr( MQSLOGBUFF ):
C PtrBufIn:
C 500)
C EndSr
Back to top
View user's profile Send private message
zpat
PostPosted: Tue May 05, 2009 8:55 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Apparently there are "user space" areas in RPG now which are undefined memory buffers up to 16 MB and this is how to get around it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Using the MQI from RPG and message size limits
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.