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 » WebSphere Message Broker (ACE) Support » add property to message header in cobol

Post new topic  Reply to topic
 add property to message header in cobol « View previous topic :: View next topic » 
Author Message
techno
PostPosted: Mon Mar 21, 2005 4:35 pm    Post subject: add property to message header in cobol Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Could somebody help me giving the code to add an application property - value to the header in message in cobol language. I know that it is in java something like msg.setStringProperty("prop", "val").

Thanks
Back to top
View user's profile Send private message
JT
PostPosted: Mon Mar 21, 2005 5:32 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

My COBOL is more than a little rusty, but this shouldn't be too far off:

Code:
WORKING-STORAGE SECTION.
  01 MQM-MESSAGE-DESCRIPTOR.
     COPY CMQMDV.
  01 MQM-PUT-MESSAGE-OPTIONS.
     COPY CMQPMOV.

PROCEDURE DIVISION.
  MOVE 'JT' TO MQMD-USERIDENTIFIER.
  COMPUTE MQPMO-OPTIONS = MQPMO_SET_IDENTITY_CONTEXT.

 CALL 'MQPUT'USING
       HCONN,
       HOBJ,
       MQM-MESSAGE-DESCRIPTOR
       MQM-PUT-MESSAGE-OPTIONS
       BUFFER-LENGTH,
       BUFFER,
       COMPLETION-CODE,
       REASON.


Need more? Look at some of the samples provided in the directory: \install_dir\IBM\WebSphere MQ\Tools\cobol\Samples
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Mar 22, 2005 5:42 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

In JMS, msg.setStringProperty("prop", "val") sets a value in the usr folder of the MQRFH2 header.

In order to do the same thing in COBOL, you will have to construct the entire MQRFH2 header manually and then construct the right piece of the usr folder to hold your data.

Likewise, you'll have to write COBOL code to READ the MQRFH2 header and extract properties from usr.

I think there are some examples.... somewhere.... maybe... or at least, the C examples should be relatively easy to convert to COBOL.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
techno
PostPosted: Thu Mar 24, 2005 10:03 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Is it necessary to have rfh2 header constructed in cobol to send key-value pair to jms client? What are the alternatives? Is there any other way to add key-value pair in cobol program? What are the ways to receive that key value pair in jms-client ?

Thanks for any help.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 24, 2005 10:15 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can put anything you want into an MQ message.

You just have to ensure that the sender and the receiver know what they are sending or receiving.

You could for instance put key/value pairs as the first section of the data message, and then code the jms client to extract them from the body of the TextMessage.

But if you want the JMS client to be able to use getProperty(), then you have to build an MQRFH2, and put the properties in the usr folder.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
techno
PostPosted: Thu Mar 24, 2005 10:55 am    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Thank you. That answer is useful.
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Mon Mar 28, 2005 11:28 pm    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

The key/value pairs in the rfh2 header must be in unicode (1208 or 1200), this might proof a problem on a EBCDIC platform. The newest COBOL compilers might support 1200 as DBCS (it does for z/OS).
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » add property to message header in cobol
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.