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 » MQRC_HEADER_ERROR

Post new topic  Reply to topic
 MQRC_HEADER_ERROR « View previous topic :: View next topic » 
Author Message
speeleti_MF
PostPosted: Tue Sep 16, 2014 5:34 pm    Post subject: MQRC_HEADER_ERROR Reply with quote

Newbie

Joined: 10 Sep 2014
Posts: 7

Hi RogerLacroix,

I am writing COBOL program to put some message along with RFH2 header data. While running cobol program, I am also getting the same error i.e.MQRC_HEADER_ERROR.

Below is the cobol structure i have defined for RFH2.

You suggested to use MQLONG instead of LONG. But i have defined S9(9) BINARY only which is equal to MQLONG. But still i am getting the same error. Kindly let me know where i did mistake.

And also please let me know while calling MQPUT, do we need to pass MQRFH or not. When i pass MQRFH, i am getting COMP CODE = 5 and REASON CODE =0000. If i dont pass MQRFH, i am getting 2142 error.

Below is MQPUT call statement used in my program

Code:
       MOVE 'MQHRF2  '                 TO MQMD-FORMAT.       
                                                   
       COMPUTE MQPMO-OPTIONS = MQPMO-NO-SYNCPOINT +       
                                                    MQPMO-FAIL-IF-QUIESCING.   

      CALL 'MQPUT' USING  WS-CON-HANDLE             
                          WS-OPO-Q-HANDLE           
                          MQMD                       
                          MQPMO                     
 *                        MQRFH                     
                          WS-OUTPUT-BUFFER-LENGTH   
                          WS-OUTPUT-BUFFER           
                          COMP-CODE                 
                          REASON-CODE.               


Below is MQRFH2 structure

  01  MQM-MQRFH2-HEADER.                                         
 ** MQRFH2 structure                                             
     10  MQRFH.                                                   
 ** Structure identifier                                         
        15  MQRFH-STRUCID PIC X(4) VALUE 'RFH '.                 
 ** Structure version number                                     
        15  MQRFH-VERSION PIC S9(9) BINARY VALUE 2.               
 ** Total length of MQRFH2 including all NameValueLength and     
 ** NameValueData fields [color=blue] (36+4+32+4+108+4+64=252)[/color]               
        15  MQRFH-STRUCLENGTH PIC S9(9) BINARY VALUE 252.         
 ** Numeric encoding of data that follows last NameValueData field
        15  MQRFH-ENCODING PIC S9(9) BINARY VALUE 273.           
 ** Character set identifier of data that follows last           
 ** NameValueData field                                           
        15  MQRFH-CODEDCHARSETID PIC S9(9) BINARY VALUE -2.       
 ** Format name of data that follows last NameValueData field     
        15  MQRFH-FORMAT PIC X(8) VALUE 'MQSTR   '.               
 ** Flags                                                         
        15  MQRFH-FLAGS PIC S9(9) BINARY VALUE 0.                 
 ** Character set identifier of NameValueData                     
        15  MQRFH-NAMEVALUECCSID PIC S9(9) BINARY VALUE 1208.     
 ** mcd folder                                                   
 ** mcd folder length is 32 characters                           
        15  MQRFH-MCD-LENGTH     PIC S9(9) BINARY VALUE 32.       
        15  MQRFH-MCD-DATA       PIC X(32)                       
            VALUE '<mcd><Msd>jms_text</Msd></mcd>  '.             
 ** jms folder                                                   
 ** jms folder length is 108 characters                           
        15  MQRFH-JMS-LENGTH     PIC S9(9) BINARY VALUE 108.     
        15  MQRFH-JMS-DATA-BGN   PIC X(05) VALUE '<jms>'.         
 ** jms - Destination field                                       
        15  MQRFH-JMS-DST1       PIC X(13) VALUE '<Dst>queue://'.
        15  MQRFH-JMS-DST2-QMGR  PIC X(05) VALUE 'MQA111'.         
        15  MQRFH-JMS-DST3       PIC X(01) VALUE '/'.             
        15  MQRFH-JMS-DST4-QUEUE PIC X(34)                       
            VALUE 'ABC.PA._ART.STD.SYAA_ABC.REQUEST.Q'.           
        15  MQRFH-JMS-DST5       PIC X(06) VALUE '</Dst>'.       
                                                                 
 ** jms - Timestamp                                               
        15  MQRFH-JMS-TMS1       PIC X(05) VALUE '<Tms>'.         
        15  MQRFH-JMS-TMS2       PIC X(13) VALUE '1234567890123'.
        15  MQRFH-JMS-TMS3       PIC X(06) VALUE '</Tms>'.       
                                                                 
 ** jms - Dlv                                                     
        15  MQRFH-JMS-DLV1       PIC X(05) VALUE '<Dlv>'.         
        15  MQRFH-JMS-DLV2       PIC X(01) VALUE '2'.             
        15  MQRFH-JMS-DLV3       PIC X(06) VALUE '</Dlv>'.       
 *                                                               
        15  MQRFH-JMS-DATA-END   PIC X(08) VALUE '</jms>  '.     
 ** usr folder                                                   
 ** usr folder length is 64 characters                           
        15  MQRFH-USR-LENGTH     PIC S9(9) BINARY VALUE 64.     
        15  MQRFH-USR-DATA-BGN   PIC X(05) VALUE '<usr>'.       
 ** usr - ClientID                                               
        15  MQRFH-USR-CID1       PIC X(10) VALUE '<ClientID>'.   
        15  MQRFH-USR-CID2       PIC X(03) VALUE 'AAA'.         
        15  MQRFH-USR-CID3-CLID  PIC X(12) VALUE '123456789012'.
        15  MQRFH-USR-CID4       PIC X(02) VALUE '::'.           
        15  MQRFH-USR-CID5-CBZID PIC X(12) VALUE '123456789012'.
        15  MQRFH-USR-CID6       PIC X(11) VALUE '</ClientId>'. 
 *                                                               
        15  MQRFH-USR-DATA-END   PIC X(09) VALUE '</usr>   '.

EDIT by exerk: Please use code tags if you're going to post code, thank you. Also, rather than re-open a four-year old topic, open a new one and refer to the old one, thank you.


Last edited by speeleti_MF on Sun Sep 21, 2014 5:39 pm; edited 3 times in total
Back to top
View user's profile Send private message
speeleti_MF
PostPosted: Tue Sep 16, 2014 8:14 pm    Post subject: Reply with quote

Newbie

Joined: 10 Sep 2014
Posts: 7

Mainframes is using MQ v7 version
Back to top
View user's profile Send private message
speeleti_MF
PostPosted: Tue Sep 16, 2014 11:32 pm    Post subject: Reply with quote

Newbie

Joined: 10 Sep 2014
Posts: 7

I heard that we should use "Message properties" for usr defined properties in MQ v7. Can any one please let me know sample code for MQCRTMH, MQSETMP and MQPUT calls in COBOL.

Appriate your help on this
Back to top
View user's profile Send private message
exerk
PostPosted: Wed Sep 17, 2014 4:13 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Have you even tried punching 'message properties cobol' into the KB search bar?
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Sep 17, 2014 4:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Or the advice given in the old thread you opened here?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Thu Sep 18, 2014 3:02 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3252
Location: London, ON Canada

Hi,

You have defined a fixed-length COBOL structure but MQRFH2 is a variable length structure where all segment lengths must be in divisible by 4 and each segment must be preceded by the segment length.

Unless you are a COBOL guru, I would stop what you are doing and start using message properties. (see the MQ knowledge Center for more info).

Regards,
Roger Lacroix
Capitalware Inc.
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
speeleti_MF
PostPosted: Sun Sep 21, 2014 5:50 pm    Post subject: Reply with quote

Newbie

Joined: 10 Sep 2014
Posts: 7

Hi Roger Lacroix,

I am writing a test program to write MQRFH2 header data. Thats the reason i have defined layout for fixed values.

And also make sure that lenght is multiple of 4.

Total Structure lenght i have given as 252 (i.e. 36+4+32+4+108+4+64)
Where,
36 - length in bytes of the MQRFH2 header structure
4 - length of NameValueData1 (for 'mcd' folder properties)
32 - NameValueData1 value
4 - length of NameValueData2 (for 'jms' folder properties)
108 - NameValueData2 value
4 - length of NameValueData3 (for 'usr' folder properties)
64 - NameValueData3 value

Each folder length is multiple of 4

Please correct me if i am wrong.. It could be helpful if you have any sample cobol code for generating MQRFH2 header.

Thanks in Advance
Back to top
View user's profile Send private message
bruce2359
PostPosted: Sun Sep 21, 2014 6:27 pm    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9394
Location: US: west coast, almost. Otherwise, enroute.

speeleti_MF wrote:
It could be helpful if you have any sample cobol code for generating MQRFH2 header.

Thanks in Advance

1. Go to google

2. In the search text box, type cobol mqrfh2

3. Click search button.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
Back to top
View user's profile Send private message
speeleti_MF
PostPosted: Sun Sep 21, 2014 8:32 pm    Post subject: Reply with quote

Newbie

Joined: 10 Sep 2014
Posts: 7

Hi Bruce,

Thanks for the reply.

I did search in Google. But i couldn't found any sample code.

Is anything wrong in MQRFH2 declaration copied in my earlier post.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Sep 22, 2014 4:53 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

speeleti_MF wrote:
I did search in Google. But i couldn't found any sample code.


Your copy of Google is broken. I got pages of hits, including from Roger's site, which I assume you found as you addressed this thread initially to him.

speeleti_MF wrote:
Is anything wrong in MQRFH2 declaration copied in my earlier post.


Yes. As Roger has already pointed out you've defined a fixed length structure which the RFH2 is not. Specifically it's not enough that the lengths be divisible by 4, they have to be divisible by 4 because the message segements have to positioned on a double word boundary. Enjoy.

This is one of the key reasons IBM invented message properties to replace the RFH2 and as you've been advised already you should be using these in preference to an RFH2 as, even though the RFH2 is fully supported and all that, it's in it's golden years.

Also message properties are much, much easier to use. If the previously suggested search term of "message properties cobol" isn't helping in either the KB or through Google then oh dear.
_________________
Honesty is the best policy.
Insanity is the best defence.
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 » MQRC_HEADER_ERROR
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.