Author |
Message
|
rvaidyan |
Posted: Fri Nov 19, 2010 12:57 pm Post subject: Generate RFH2 header using RPGLE |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
Hello,
I am trying to generate RFH2 header while sending a message to a remote queue. The development is using RPGLE and i am using the copybook source CMQRFH2G available in QMQM/QRPGLESRC. Under the variable portion of RFH2 header, i am trying to send only <usr> data. I also use the RFHUTIL software to check and see whether RFH header is generated or not.
The issue that i face is, when i call the program that generates the RFH2 & the message body, the RFH data never comes up. Even though RFHUTIL says, it is recognizing "other" folder, but doesnt work all.
I am sure that im kind of messing up in defining the RFH2 total length, but couldnt figure out the problem.
Has anyone generated RFH2 header using RPGLE? Can you post the code incase you have it.
Thanks
Ram
Code: |
D* MQRFH2 Structure
D*
D* Structure identifier
D RF2SID 1 4 INZ('RFH ')
D* Structure version number
D RF2VER 5 8I 0 INZ(2)
D* Total length of MQRFH2 including allNameValueLength and
D* NameValueDatafields
D RF2LEN 9 12I 0 INZ(288)
D* Numeric encoding of data that followslast NameValueData field
D RF2ENC 13 16I 0 INZ(546)
D* Character set identifier of data thatfollows last NameValueData
D RF2CSI 17 20I 0 INZ(437)
D* Format name of data that follows lastNameValueData field
D RF2FMT 21 28 INZ('MQSTR ')
D* Flags
D RF2FLG 29 32I 0 INZ(0)
D* Character set identifier ofNameValueData
D RF2NVC 33 36I 0 INZ(1208)
D* Length of user data field
D RF2NVL 37 40I 0 INZ(248)
D* Value of user data field
D RF2NVD 41 288A INZ
|
|
|
Back to top |
|
 |
rvaidyan |
Posted: Mon Nov 22, 2010 2:04 pm Post subject: No responses for this topic?? |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
Hello,
Has not anyone generated RFH2 using RPGLE? Please help.
Thanks
Ram |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 22, 2010 8:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Did you check the length of the record and make sure that it had the correct 4 byte alignment?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rvaidyan |
Posted: Mon Nov 22, 2010 8:42 pm Post subject: |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
Yes, I did. I added extra 4 bytes for the folder and ensured that it has 4 byte alignment.
Thanks
Ram |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 22, 2010 8:55 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rvaidyan wrote: |
Yes, I did. I added extra 4 bytes for the folder and ensured that it has 4 byte alignment.
Thanks
Ram |
Wrong thing to do. 4 byte alignement means that the total number of bytes needs to be divisible by 4 (xxx mod 4 = 0 ).
So adding 4 bytes does not cut it in any ways.
Say:
- total length = 4 bytes ==> add 0 bytes
- total length = 5 bytes ==> add 3 bytes
- total length = 6 bytes ==> add 2 bytes
- total length = 7 bytes ==> add 1 byte
- total length = 8 bytes ==> add 0 byte
And so forth ....
And don't forget that those added bytes now also count in the total length of the RFH  _________________ MQ & Broker admin
Last edited by fjb_saper on Mon Nov 22, 2010 8:59 pm; edited 1 time in total |
|
Back to top |
|
 |
rvaidyan |
Posted: Mon Nov 22, 2010 8:58 pm Post subject: |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
Apologies, if i didnt make it clear. My entire length (fixed & variable) of RFH2 header is 36 + 248 = 284. Plus I have added 4 bytes to bring it to 288, which is still divisible by 4.
The only thing i still doubt is, how to write the RFH2 to the MQ buffer. Do you know how to do that?
Any help is appreciated.
Thanks
Ram |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Nov 22, 2010 9:01 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rvaidyan wrote: |
Apologies, if i didnt make it clear. My entire length (fixed & variable) of RFH2 header is 36 + 248 = 284. Plus I have added 4 bytes to bring it to 288, which is still divisible by 4.
The only thing i still doubt is, how to write the RFH2 to the MQ buffer. Do you know how to do that?
Any help is appreciated.
Thanks
Ram |
You write it to the buffer as you would with any binary payload.
The RFH is basically the begin of your payload. What follows the RFH in your payload is your actual message content.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 23, 2010 2:22 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MQ headers that are contained in what would otherwise be the message body are separated by blank lines, IIRC.
So
MQMD
MQRFH2
MQRFH2
Message Data
If I recall correctly. Documentation in the APG or APR, I'm sure. |
|
Back to top |
|
 |
rvaidyan |
Posted: Tue Nov 23, 2010 2:05 pm Post subject: |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
I believe, somehow i managed to put in RFH2 header. Using the RFHUTIL, i reviewed the message. I have managed to put <usr> folder in the variable part of RFH2 message.
While reviewing the message using the utility, it says, it cannot recognize the <usr> folder
Any help?
- Ram |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Nov 24, 2010 3:50 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Are you sure your <usr> folder starts where it is supposed to?
I believe both sections need to be "aligned"...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
rvaidyan |
Posted: Wed Nov 24, 2010 6:20 am Post subject: |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
fjb_saper wrote: |
Are you sure your <usr> folder starts where it is supposed to?
I believe both sections need to be "aligned"...  |
Hello,
Not sure if i understood your comment above. I have used <usr> folder to be in variable part of the field.
Can you explain a little bit on "both sections need to be aligned"?
Thanks
Ram |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 24, 2010 6:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
variable length sections in RHF headers need to be aligned on specific byte boundaries, usually in 4-byte lengths. This means that if, for example, your usr folder is 37 bytes long, you need to add extra bytes to the end so that it is 40 bytes long.
This is from memory, though, so please review the discussions in the APG and APR on the RFH2 header again. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 24, 2010 6:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
variable length sections in RHF headers need to be aligned on specific byte boundaries, usually in 4-byte lengths. This means that if, for example, your usr folder is 37 bytes long, you need to add extra bytes to the end so that it is 40 bytes long.
This is from memory, though, so please review the discussions in the APG and APR on the RFH2 header again. |
|
Back to top |
|
 |
rvaidyan |
Posted: Wed Nov 24, 2010 6:43 am Post subject: |
|
|
Novice
Joined: 19 Nov 2010 Posts: 10
|
Yes. The <usr> folder that i am trying to generate is 131 bytes long and i actually added 5 bytes to ensure, it is always divisble by 4. Overall the length of RFH2 is
Fixed - 36 Bytes
Variable - 136
Total - 172 bytes.
Thanks
Ram |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 24, 2010 8:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
It also needs to start on a proper boundary, that is all of the sections before it need to be in lengths that are divisible by 4.
fixed: 36
section 1 of variable length%4=0
section 2 of variable length%4=0
...
not just the total structure, but each component. |
|
Back to top |
|
 |
|