QMHRDQM: Offset to first message entry on the RDQM0100 format

70 pts.
Tags:
offset
QMHRDQM
RcvDtaQMsg
RcvVar
RDQM0100
Hello! I'm having a very hard time with this API. I'm an absolute rookie working with pointers. My problem is, I have the value of the offset but this offset is relative to what? I was trying from the beggining of the "RcvVar", but it doesn't seem to work... d RcvVar ds Qualified d BytesRet 1 4I 0 d BytesAvail 5 8I 0 d NbrMsgsRet 9 12I 0 d NbrMsgsAvail 13 16I 0 d MsgKeyLenRet 17 20I 0 d MsgKeyLenAva 21 24I 0 d MsgTxtLenRet 25 28I 0 d MsgTxtLenAva 29 32I 0 d EntryLenRet 33 36I 0 d EntryLenAva 37 40I 0 d Offset1MsgE 41 44I 0 d ActDtaQLib 45 54A d Reserved 55 32766A d MsgTxt s 50A based(ptrMsgTxt) callp RcvDtaQMsg(RcvVar: %len(RcvVar) : 'RDQM0100' : QualDtaQName : MsgSltInf : 8 : 'RDQS0100': Error); ptrMsgTxt = %addr(Reserved) + RcvVar.Offset1MsgE; Thanks in advance!

Answer Wiki

Thanks. We'll let you know when a new response is added.

So close! Rather than using %addr(Reserved) try %addr(RcvVar).

But note that ptrMsgTxt is not pointing directly to MsgTxt. It is pointing to another structure which contains:

Offset to next message entry
Message enqueue date and time
Message key
Message text

To find the message text you will need to increment ptrMsgTxt (or its equivalent) by the bytes allocated for the first three fields within this sub structure.

Bruce Vining

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Mr.
    Hi, Bruce! Initially I tried ptrMsgTxt = %addr(RcvVar) + RcvVar.Offset1MsgE; While debugging, when I evaluate MsgTxt (after the assignment above) I get this result: MSGTXT = '++++þ+++ÕSØ+INQMT00000108-77-VV0000000014000001000...' it starts with "garbage", which, I supose, corresponds to those variables you referred. I can see my message there (bold). If the API says "offset to 1st message entry, it (the offset) should be directly to the message; not to the data structure you referred. That complicates everything because the Message Key is of variable length. I forgot to mention that this is a *FIFO data queue.
    70 pointsBadges:
    report
  • bvining
    Sorry, but I assure you the offset is to the start of the message entry (the sub structure) and not the message text. However not all is lost! When you call the API it also returns what you have defined as MsgKeyLenRet. I would suggest defining another pointer ptrRealMsgTxt and setting this to your current (ptrMsgTxt + 12 + MsgKeyLenRet). If you also change MsgTxt to now be Based on this new ptrRealMsgTxt I suspect that you will find the message text you are seeking. The 12 that is being added to ptrRealMsgTxt is to get past the substructure offset and enqueue fields. I would also define a structure (based on ptrMsgTxt) which defines the Offset to next message entry field and the enqueue field. To get to the next message entry ptrMsgTxt = %addr(RcvVar) + Offset to next message entry (as the Basing pointer ptrMsgTxt is pointing to the current message entry substructure). Reassign ptrRealMsgTxt as above and you've got the next message. Note that I did not build a test case for the above. But based on experience with APIs and the terminology being used by the API documentation, the above should work. Hope this helps, Bruce
    6,465 pointsBadges:
    report
  • Mr.
    report
  • Mr.
    Oops! Is there any way I can edit or delete my "posts"? I meant "If you go to http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apiref/listGeneral.htm and look..."
    70 pointsBadges:
    report
  • bvining
    The warning about base 0 and base 1 is more related to substring operations in RPG or COBOL. As you are using pointers and based structures/fields you don't need to worry about it (as you discovered). Glad I was able to help, Bruce Vining Bruce Vining Services
    6,465 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following