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 » Generate RFH2 header using RPGLE

Post new topic  Reply to topic Goto page 1, 2  Next
 Generate RFH2 header using RPGLE « View previous topic :: View next topic » 
Author Message
rvaidyan
PostPosted: Fri Nov 19, 2010 12:57 pm    Post subject: Generate RFH2 header using RPGLE Reply with quote

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
View user's profile Send private message
rvaidyan
PostPosted: Mon Nov 22, 2010 2:04 pm    Post subject: No responses for this topic?? Reply with quote

Novice

Joined: 19 Nov 2010
Posts: 10

Hello,

Has not anyone generated RFH2 using RPGLE? Please help.

Thanks
Ram
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 22, 2010 8:38 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rvaidyan
PostPosted: Mon Nov 22, 2010 8:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 22, 2010 8:55 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rvaidyan
PostPosted: Mon Nov 22, 2010 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 22, 2010 9:01 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Nov 23, 2010 2:22 am    Post subject: Reply with quote

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
View user's profile Send private message
rvaidyan
PostPosted: Tue Nov 23, 2010 2:05 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Nov 24, 2010 3:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
rvaidyan
PostPosted: Wed Nov 24, 2010 6:20 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Wed Nov 24, 2010 6:37 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Wed Nov 24, 2010 6:37 am    Post subject: Reply with quote

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
View user's profile Send private message
rvaidyan
PostPosted: Wed Nov 24, 2010 6:43 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Wed Nov 24, 2010 8:33 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » Generate RFH2 header using RPGLE
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.