|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
JMS MQ to CICS Bridge |
« View previous topic :: View next topic » |
Author |
Message
|
blakev |
Posted: Wed Jun 25, 2003 3:09 am Post subject: JMS MQ to CICS Bridge |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
Hi,
I want to send an MQ message, using JMS to a CICS BRidge on an OS/390 Mainframe.
I have the MQ Client and Java classes installed on my machine. HAve MQ Server installed on a Windows NT machine.
Have Queues, Queue MAnagers, administered objects, client connection channels etc set up.
I've created a TextMessage and added text and send the message. This has appeared on the queue on the mainframe... great!!
Now, I want to start sending some valid data so that the mainframe program can process messages and start sending me some responses.
First off, I read somewhere that you need to use a BytesMessage when sending messages to an IMS bridge... is it the same for a CICS Bridge? I tried sending a BytesMessage (using the writeBytes() method to set everything), but the data appears as garbage on the Mainframe queue. Is this something to do with conversion from ASCII to EBCDIC? Again, do I even need to use BytesMessage????
Also, the mainframe program seems to be pretty hairy. It seems to expect the MQMD-CORRELID to be set to MQCI-NEW-SESSION. What's MQCI-NEW-SESSION in JMS land????
Also it seems to expect the JMS_IBM_Format parameter to be set to MQCICS. When I try this I get a 2007 error...
Anyone out there know anything about sending MQ messages to a CICS Bridge, specifically using JMS???
Cheers,
Vinny |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Jun 25, 2003 8:35 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
To be honest, I don't have any definitive answers to your questions. However, there are some IMS bridge samples at:
http://www.developer.ibm.com/tech/sampmq.html
One is for java (imsbridge.java) and one is for jms (JmsIMSBridge.java). They might shed some light on your questions. |
|
Back to top |
|
 |
blakev |
Posted: Wed Jun 25, 2003 8:48 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
Hiya,
Thanks for that.
I'd already found these examples... they were helpful, but not quite what I'm looking for...
Vinny |
|
Back to top |
|
 |
EddieA |
Posted: Wed Jun 25, 2003 9:28 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
If a 'Text' message appeared at the mainframe correctly, then why not use this. You should only have to resort to 'Byte', if the mainframe is expecting data that is in a format other than pure text: binary, packed decimal, etc.
MQCI-NEW-SESSION = X'414D51214E45575F53455353494F4E5F434F5252454C4944'
Or in character: AMQ!NEW_SESSION_CORRELID
You should only set the Format to MQCICS when you are including an MQCIH structure. The DPL part of the bridge will work without this. I don't know of any way of building this structure in JMS, other than 'by hand'.
Also, you may have to set the option to state that the 'Receiver' is not JMS aware, so that an RFH2 header is not included.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
blakev |
Posted: Thu Jun 26, 2003 1:59 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
Hiya there,
Thanks for that.
1) Sending a "Text" message.
2) Set the JMSCorrelationID to "AMQ!NEW_SESSION_CORRELID"
3) Have TARGCLIENT parameter on Administered Q Object set to "MQ", so no RFH2 header sent.
34 Not setting the MQMD.Format, or building up the CIH Header.
Message appearing on the CICS Bridge queue, looks fine.
But is not being taken off the queue.
Does anyone know of a way to find out the the reason why the Bridge program couldn't take the message off the queue. Are there errors generated, and if so, where???
Cheers,
Vinny |
|
Back to top |
|
 |
blakev |
Posted: Thu Jun 26, 2003 6:32 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
Ok, the Bridge program is now taking the message off the Queue... great!
Now, the program is failing because there is no CIH Header.
I've written code to build up the CIH Header, but I'm getting a "javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue" error.
The linked exception is: "Linked exception: com.ibm.mq.MQException: Completion Code 2, Reason 2142"
Basically the CIH Structure is wrong. I'm still using the TextMessage and using the setXXXProperty methods to build the CIH header.
There is an example on the web of building up the IMS IIH Header. It uses the BytesMessage object. Do I need to use this??
Here's my code to build up the CIH as it is.... maybe there's something obvious wrong here:
public static TextMessage buildMQCIH(TextMessage textMsg) throws JMSException
{
((Message)textMsg).setStringProperty("JMS_IBM_Format", "MQCICS");
String s_StrucID = new String ("CIH ");
String s_Format = new String ("MQSTR ");
// String s_Format = new String (" ");
String s_TranId = new String ("APIB");
String s_Function = new String(" ");
String s_AbendCode = new String(" ");
String s_Authenticator = new String(" ");
String s_Reserved1 = new String(" ");
String s_RemoteSysId = new String (" ");
String s_RemoteTranId = new String (" ");
String s_FacilityLike = new String (" ");
String s_AttentionId = new String (" ");
String s_StartCode = new String (" ");
String s_CancelCode = new String (" ");
String s_NextTranId = new String (" ");
String s_Reserved2 = new String (" ");
String s_Reserved3 = new String (" ");
textMsg.setStringProperty("StrucID", s_StrucID);
textMsg.setIntProperty("Version", 1); //Version
textMsg.setIntProperty("StrucLength", 164); //Struc Length v1=164 v2=180
textMsg.setIntProperty("Encoding", 0); //encoding
textMsg.setIntProperty("CodedCharSetId", 1208); // CharacterSet
textMsg.setStringProperty("Format", s_Format); // format
textMsg.setIntProperty("Flags", 0); // Flags
textMsg.setIntProperty("ReturnCode", 0); // Return Code
textMsg.setIntProperty("CompCode", 0); // CompCode
textMsg.setIntProperty("Reason", 0); // Reason
textMsg.setIntProperty("UOWControl", 273); // Unit Of Work Control...MQCUOWC_ONLY=273
textMsg.setIntProperty("GetWaitInterval", -2); // Wait Interval for MQGET call issued by bridge
textMsg.setIntProperty("LinkType", 1); // LinkType
textMsg.setIntProperty("OutputDataLength", 2000); // Output Data Length
textMsg.setIntProperty("FacilityKeepTime", 0); // FacilityKeepTime
textMsg.setIntProperty("ADSDescriptor", 0); // ADSDescriptor
textMsg.setIntProperty("ConversationalTask", 0); // ConversatioalTask
textMsg.setIntProperty("TaskEndStatus", 0); // TaskEndStatus
String temp = " " ;
textMsg.setStringProperty("Facility", temp); // Facility BVT token value
textMsg.setStringProperty("Function", s_Function); //Function MQ call name or CICS EIBFN Function
textMsg.setStringProperty("AbendCode", s_AbendCode); //Abend Code
textMsg.setStringProperty("Authenticator", s_Authenticator); //Password
textMsg.setStringProperty("Reserved1", s_Reserved1); // Reserved
textMsg.setStringProperty("ReplyToFormat", s_Format); //ReplyToFormat
textMsg.setStringProperty("RemoteSysId", s_RemoteSysId); // RemoteSysId
textMsg.setStringProperty("RemoteTranId", s_RemoteTranId); // RemoteTransId
textMsg.setStringProperty("TransactionId", s_TranId); // TransactionId
textMsg.setStringProperty("FacilityLike", s_FacilityLike); // FacilityLike
textMsg.setStringProperty("AttentionId", s_AttentionId); // AttentionId
textMsg.setStringProperty("StartCode", s_StartCode); // StartCode
textMsg.setStringProperty("CancelCode", s_CancelCode); // CancelCode
textMsg.setStringProperty("NextTransactionId", s_NextTranId); // NextTranId
textMsg.setStringProperty("Reserved2", s_Reserved2); // Reserved2
textMsg.setStringProperty("Reserved3", s_Reserved3); // Reserved3
return textMsg; |
|
Back to top |
|
 |
EddieA |
Posted: Thu Jun 26, 2003 8:46 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
What's the failure in the Bridge. You are trying to use DPL, ("LinkType", 1), which WILL work without an MQCIH.
Don't know about the Text vs. Bytes part. I'm not a Java programmer by trade. But it seems strange (to me) that you can set Ints in a Text message.
I would try setting the MQMD Format to anything that doesn't start with MQ, just to be able to PUT it without the 2142 error, and then look at the message to make sure the MQCIH really is formatted how you think.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
blakev |
Posted: Wed Jul 02, 2003 5:59 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
Ok, things have moved on a bit.
I'm using a BytesMessage to send the MQMessage.
The messagw is going to a CICS Bridge via a Queue Manager on an NT machine.
The message has a CIH Header included.
When I set the MQMD Format to MQSTR, the message arrives successfully on the Bridge. However the Bridge program fails coz it's expecting the Format to be set to MQCICS. When I set the Format to MQCICS the message doesn't get to the Bridge. It gets put on the Dead Queue on the NT machine with a Reason Code 2110.... Invalid Format error.
I checked and the Sender channel had CONVERT=Yes. Changed to No, but still getting the same problem.
Anyone any ideas? Do you have enough info?
Please don't tell me I have to write a data conversion exit.... |
|
Back to top |
|
 |
pjrmoreira |
Posted: Wed Jul 02, 2003 6:49 am Post subject: |
|
|
Novice
Joined: 02 Jul 2003 Posts: 14
|
Hi,
I also have a JMS application using the MQ-CICS bridge. I'm trying to execute a DPL program, and I'm not using any MQCIH. My JMS application is putting the message directly on the request queue, and the message is being processed. My problem is that all the responses are going to the Dead-Letter queue, with the reason code 266 (MQFB_TM_ERROR). I don't know how this error can be related with my message content. Anyone can help me? Following I present a sample of the code I'm using:
((MQDestination)dest).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
BytesMessage outMessage = session.createBytesMessage();
outMessage.setJMSReplyTo((Destination)respQueue);
((Message)outMessage).setStringProperty("JMS_IBM_Format", MQC.MQFMT_NONE);
((Message)outMessage).setJMSMessageID(new String(MQC.MQMI_NONE));
((Message)outMessage).setJMSCorrelationIDAsBytes(MQC.MQCI_NEW_SESSION);
String myMessageBody = new String("PROGRAM2");
String commarea = "266025760256243";
outMessage.writeBytes(myMessageBody.getBytes());
outMessage.writeBytes(commarea.getBytes());
queueSender.send(outMessage);
Thanks
PM |
|
Back to top |
|
 |
blakev |
Posted: Thu Jul 03, 2003 5:19 am Post subject: |
|
|
Newbie
Joined: 25 Jun 2003 Posts: 6
|
My problem is solved...
Setting the CONVERT=No on the Sender Channel did the trick.
Thanks to anyone who replied to my various issues.
Cheers,
Vinny |
|
Back to top |
|
 |
EddieA |
Posted: Thu Jul 03, 2003 10:38 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Glad you got it all working.  _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|