|
Hi Alistair,
>
> We have recently been exploring the MQ route and I have a question f
> the MQ API boffins out there. We may well be receiving messages
> om excess pf 32K. Since the MQGET API specifies that you must
> retrieve the message into a single RPG-ILE variable, you are
> limited to 32K as a maximum message length.
>
> My question is, therefore, how would you retrieve a message longer
> than 32K.
First of all, let me state that I'm not at all familiar with MQSeries,
but I've had to deal with similar situations in which an API returns
a string thats too big for RPG to deal with directly.
I'm assuming that the API that you're calling passes a string by
reference. (all dynamic calls do this, and bound calls do if the
keyword "value" is not specified)
Okay, finally to my solution... When you pass a parm by reference,
it only actually passes the address of the parameter to the other
program. If you were to pass a shorter variables that's based in
the same area as a user-space, you could (effectively) pass a
string thats up to 16MB long... :)
Here's a quick (untested) example:
D CrtUsrSpc PR ExtPgm('QUSCRTUS')
D peUsrSpc 20A CONST
D peExtAtr 10A CONST
D peInitSiz 10I 0 CONST
D peInitVal 1A CONST
D pePubAuth 10A CONST
D peText 50A CONST
D peReplace 10A CONST
D peErrors 256A
D RtvPtrUS PR ExtPgm('QUSPTRUS')
D peUsrSpc 20A CONST
D pePointer *
D dsEC DS
D* Bytes Provided (size of struct)
D dsECBytesP 1 4B 0
D* Bytes Available (returned by API
D dsECBytesA 5 8B 0
D* Msg ID of Error Msg Returned
D dsECMsgID 9 15
D* Reserved
D dsECReserv 16 16
D* Msg Data of Error Msg Returned
D dsECMsgDta 17 256
D p_Var S *
D Var S 1A BASED(p_Var)
D VarMaxLen S 10I 0
c eval dsECBytesP = 256
C callp CrtUsrSpc('SPACE QTEMP':'USRSPC':
C 1:x'00':'*ALL':'Big string from API':
c '*YES': dsEC)
c if dsECBytesA > 0
c*** handle failure to create user space here
C endif
C callp RtvPtrUS('SPACE QTEMP':p_Var)
C* 16MB
c eval VarMaxLen = (16*1024*1024)
c call 'MYAPI'
c parm Var
c parm VarMaxLen
c eval *INLR = *On
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.