IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Convert MQHRF2 to STRING format


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Gurumanoj Gurusamy

New User


Joined: 11 Nov 2010
Posts: 22
Location: Mumbai

PostPosted: Mon Dec 26, 2011 3:03 pm
Reply with quote

Hi,

I am writing a cobol program to get the messages from MQ and extract specific details from the message using INSPECTclause.

I have used below logic to convert RFH2 message to String format but its not working. Could you please suggest the correct encoding and CodedCharSetId.

MOVE MQMD-VERSION-1 TO MQMD-VERSION.
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
MOVE 785 TO MQMD-ENCODING.
MOVE 285 TO MQMD-CODEDCHARSETID.
MOVE 4 TO MQMD-PRIORITY.
MOVE MQFMT-STRING TO MQMD-FORMAT.
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.



The data in MQ is in below format:
Message Descriptor
StrucId : 'MD '
Version : 000000001
Report : 000000000
MsgType : 000000008
Expiry : -00000001
Feedback : 000000000
Encoding : 000000273
CodedCharSetId : 000000500
Format : 'MQHRF2 '
Priority : 000000004
Persistence : 000000001
MsgId : 'C3E2D840D4D8E3F24040404040404040C8DB86F1D683C008'X
CorrelId : '757569643A38616661373630302D326336332D313165312D'X
BackoutCount : 000000004
ReplyToQ : ' '
ReplyToQMgr : 'MQT2 '
UserIdentifier : 'STCEDAFD '
AccountingToken :
'0000000000000000000000000000000000000000000000000000000000000000'X
ApplIdentityData :

Many Thanks
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 26, 2011 3:15 pm
Reply with quote

I have no idea what is wrong. You haven't mentioned what it is that is not working, and haven't shown any data definitions. If you want some assistance we need more information, please.
Back to top
View user's profile Send private message
Gurumanoj Gurusamy

New User


Joined: 11 Nov 2010
Posts: 22
Location: Mumbai

PostPosted: Mon Dec 26, 2011 3:46 pm
Reply with quote

The RFH format is not getting converted into string because of which INSPECT clause is not working.

Here is the sysout from spool where i have displayed the message get from MQ:

WS-MSGBUFFER:RFH ü ½ ½ _ÄÀ (ËÀ ¦_ˬÂ`ÈÁË (ËÀ
èá+è¬(åê êáë& àËÈ è_Ë è_Ë äÑÀ ÍÍÑÀ /Ã/ Ä Á / /à /
ÁÊËÑ?> Á>Ä?ÀÑ>Å íèã Ë?/øÁ>Î á>ÎÁ%?øÁ Ì_%>Ë Ë?/øÁ>Î ÇÈÈø ËÄÇÁ_/Ë Ì
Èø ÏÏÏ Ï ?ÊÅ ì(<ëÄÇÁ_/ Ì_%>Ë ÌËÑ ÇÈÈø ÏÏÏ Ï ?ÊÅ ì(<ëÄÇÁ_/ Ñ>ËÈ
Ê ÇÈÈø ËÄÇÁ_/Ë Ì_%Ë?/ø ?ÊÅ Ë?/ø /ÄÈ?Ê >ÁÌÈ Ë?/øÁ>Î
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 26, 2011 3:58 pm
Reply with quote

I'm not sure what you mean by "converted into [a] string", or where INSPECT comes into it.

You DISPLAY is simply showing a lump of binary data, with the code-page that you are using. If you use something with the correct code-page, then you will be able to "see" the characters, but there is no problem with the data just being like that until you need to see it.

So, where do you need to see it? DISPLAY is not normally used for "real" output, stuff that users will see. So what is the user going to see?
Back to top
View user's profile Send private message
Gurumanoj Gurusamy

New User


Joined: 11 Nov 2010
Posts: 22
Location: Mumbai

PostPosted: Mon Dec 26, 2011 4:20 pm
Reply with quote

actually i want to convert this RFH format data received from MQ into string format so that it is readable by us.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 26, 2011 5:02 pm
Reply with quote

Doesn't the documentation from IBM tell you how to do this?

If you just want to see the byte values for checking, put HEX ON when you look at the list output.

Or, use the Junk Buster, aka BBHEXD. Search this forum.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Tue Jan 10, 2012 11:13 pm
Reply with quote

Hi,

I am trying to write a MQ message with RFH2 Header in COBOL. I searched this forum & IBM site and found out the cobol declaration with default values.

I am not able to understand those parameters and how to use it in PUT statement.

Is there any link for me to start with.

Any kind of help would be appreciated.

Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 11, 2012 1:18 am
Reply with quote

www-01.ibm.com/software/integration/wmq/library/
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Wed Jan 11, 2012 4:59 am
Reply with quote

I did go thru the above link. It was mostly related to MQ installation. I could not find much related to COBOl coding for this Header MQ.

Is there any specific documentation for COBOL.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 11, 2012 6:36 am
Reply with quote

sorry, application manuals are written with the concept of the application in mind,
examples are given for different programming languages.

look at the MQS programmers guide.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Jan 11, 2012 7:43 am
Reply with quote

How about using the DISPLAY-OF and NATIONAL-OF intrinsic functions of COBOL? See the example in section 1.7.5.6 of the COBOL Programming Guide manual (link at the top of this page) -- would that not do what you want?
Back to top
View user's profile Send private message
rakesh1155

New User


Joined: 21 Jan 2009
Posts: 84
Location: India

PostPosted: Wed Jan 11, 2012 4:20 pm
Reply with quote

@Gurumanoj Gurusamy - Did you use MQGMO-CONVERT during the MQGET in the COBOL program ?

Or as Mr Robert suggested, the DISPLAY-OF and NATIONAL-OF functions will help to convert if not converted during the MQGET.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Tue Jan 31, 2012 3:07 am
Reply with quote

Hi,

I lost a bit of track on this.

Purpose: Write a MQ message with RFH2 Header in Cobol & populate the USR folder with an XML string.

Progress:
Found the MQ RFH2 Structure to be declared.

PUT Message: Is it a regular MQ PUT call or do we need any other fields to set apart from setting MQMD-FORMAT as RFH2-HEADER.

USR Folder. There is a MQ variable 'MQRFH2-USER-FOLDER'. I know I need to insert data into this folder. This variable simply points to it it. I am not able to find the variable, which I need to populate finally.

Have gone thru MQS & Cobol programming guide. Didn't find anything useful.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jan 31, 2012 4:02 am
Reply with quote

I google for MQRFH2-USER-FOLDER. Google suggested MQRFH2-USR-FOLDER was better. Got hits. Didn't wade into it as you know more about it than I do.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Tue Jan 31, 2012 4:43 am
Reply with quote

Bill,

I also got the same message from Google but none of the links were fruitful with suggested search.
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Tue Jan 31, 2012 11:44 am
Reply with quote

I am trying few things. I have a question ?
Do we need to write the USR folder literals in some other encoding to get it populated successfully on MQ?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top