Author |
Message
|
techno |
Posted: Mon Mar 21, 2005 4:35 pm Post subject: add property to message header in cobol |
|
|
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 |
|
 |
JT |
Posted: Mon Mar 21, 2005 5:32 pm Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Tue Mar 22, 2005 5:42 am Post subject: |
|
|
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 |
|
 |
techno |
Posted: Thu Mar 24, 2005 10:03 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Mar 24, 2005 10:15 am Post subject: |
|
|
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 |
|
 |
techno |
Posted: Thu Mar 24, 2005 10:55 am Post subject: |
|
|
Chevalier
Joined: 22 Jan 2003 Posts: 429
|
Thank you. That answer is useful. |
|
Back to top |
|
 |
jfluitsm |
Posted: Mon Mar 28, 2005 11:28 pm Post subject: |
|
|
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 |
|
 |
|