Author |
Message
|
chades |
Posted: Thu Jan 29, 2009 7:53 am Post subject: Sending EBCDIC message with Packed Decimal data |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 6
|
I don't know if this is the right forum, but I have a question regaring EBCDIC message. I'm new to MQ too:(.
I have a file containing EBCDIC message with Packed Decimal data. I want to send this file as a message to a MQ Broker. I'm running on a WAS server and I send my message to a local MQ queue.
When the message arrives at the target, it's garbled.
Is there any configuration that I need to set? Is there any manual conversion I need to do?
I upload the file in a JSP page and capture data in a string which I pass to an EJB that puts it on a local queue.
Any help in this regard is greatly appreciated. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jan 29, 2009 8:03 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
I gather from your post that the originating application is running on a z/OS system. (Packed-decimal was the clue.) And that the target queue is on some other platform, like Windows or UNIX? _________________ 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 |
|
 |
Vitor |
Posted: Thu Jan 29, 2009 8:06 am Post subject: Re: Sending EBCDIC message with Packed Decimal data |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
chades wrote: |
I have a file containing EBCDIC message with Packed Decimal data. I want to send this file as a message to a MQ Broker. I'm running on a WAS server and I send my message to a local MQ queue.
When the message arrives at the target, it's garbled.
|
I'll assume here that your local queue is either Windows or Unix.
Check the Format field of the MQMD on a message. If it describes the message as a String, and the message is being retrieved with conversion, then the entire message will be treated as EBCDIC text and converted. So characters will look fine, but packed data will look like cream cheese.
If the message is described as None (no format) the message will be delivered in it's raw state. So all the character is cream cheese and the packed decimal will be the wrong way round (most midrange platforms hold high order bytes the other way round to a mainframe).
Either way, not good.
If you do have this kind of mixed format (character & packed decimal) you'll have to convert it by hand within your code. If you can persuade something to unpack the data (PIC 9(9) rather than PIC S9(9) COMP-3) then you can describe it as a string to WMQ and use the inbuilt conversion. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
chades |
Posted: Thu Jan 29, 2009 8:23 am Post subject: Sending EBCDIC message with Packed Decimal data |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 6
|
I should have provided more information upfront.
I AM on a windows machine. I am trying to replicate a z/OS machine sending a message to a broker. I took a z/OS message which has packed decimal data and put in a file.
Now, I'm trying to send this message to the broker as though the z/OS system sent it.
My sending code is below. Connection Factory and mqQueue are administered objects set on my object by spring.
connectionHandle= (com.ibm.ejs.jms.JMSQueueConnectionHandle)connectionFactory.createQueueConnection();
sessionHandle = (JMSQueueSessionHandle)connectionHandle.createSession(false, Session.AUTO_ACKNOWLEDGE);
session = (MQQueueSession)sessionHandle.getSession();
sender = (MQQueueSender)session.createProducer(mqQueue);
JMSTextMessage textMessage = (JMSTextMessage)session.createTextMessage(xml); // xml is the incoming message in a string
Destination dest = session.createQueue(replyTo);
textMessage.setJMSReplyTo(dest);
sender.send(testMessage)
You can see from the code above.....I'm really new to MQ API .
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 29, 2009 8:30 am Post subject: Re: Sending EBCDIC message with Packed Decimal data |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
chades wrote: |
JMSTextMessage textMessage = (JMSTextMessage)session.createTextMessage(xml); // xml is the incoming message in a string |
Ah - much simpler situation!
Disclaimer: I'm not that good with Java! (Great with mainframes though)
If you want to emulate a z/OS message with packed data, this should be a byte message as it's not pure text. Send it as a text message and the receiving end will try and convert it, resulting in the gibberish you're seeing.
Unless I'm completely wrong of course.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Jan 29, 2009 10:04 am Post subject: Re: Sending EBCDIC message with Packed Decimal data |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
chades wrote: |
I AM on a windows machine. I am trying to replicate a z/OS machine sending a message to a broker. I took a z/OS message which has packed decimal data and put in a file. |
Download the file from z/OS as binary. Create a simple Java or C program to put the message to the remote queue BUT the program MUST set the Encoding and CCSID to be that of z/OS and then it will work.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
chades |
Posted: Thu Jan 29, 2009 2:10 pm Post subject: |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 6
|
Hi,
I tried using ByteMessage. But that did not solve the problem.
Regarding the CCSID and Encoding Type, what type of Message should I be sending? ByteMessage or simple Text Message?
Again.....Thanks!! |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jan 29, 2009 2:28 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
chades wrote: |
Regarding the CCSID and Encoding Type, what type of Message should I be sending? ByteMessage or simple Text Message?
|
2 different questions. It should be byte message I believe, and the CCSID & Encoding should match those for z/OS as Roger says (500 and little endian? Can't remember, look it up). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Jan 30, 2009 4:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Vitor is right there.
You will have to create a different configuration for your qcf.
On the qcf you need to specify the CCSID for the mainframe and the corresponding Encoding (little vs big endian etc...785?). If there is a qmgr on the mainframe ask the MQ admin what the parameters are.
Now you create the BytesMessage and fill it with the content from your file.
Send the message to the destination and let us know how it went.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
cschneid |
Posted: Fri Jan 30, 2009 6:14 am Post subject: |
|
|
Novice
Joined: 22 Mar 2005 Posts: 13
|
Footnote to the CCSID and endian-ness of machines running z/OS:
On the z/OS box where I work we have multple CCSIDs in effect, depending on where you are and what you are doing. MQ's CCSID is 500, DB2's is 37, the default for COBOL is 1140.
All of the above is to speak to the question, "What code page do we use on the mainframe?" The answer may be more complex than you would like.
Boxes running z/OS are typically big-endian (big-end first, i.e. the most significant digits come first). A two-byte binary integer containing decimal 10 would be represented in hex as x'000a'. On a little-endian machine the same number would be represented as x'0a00'. |
|
Back to top |
|
 |
chades |
Posted: Tue Feb 03, 2009 3:41 pm Post subject: |
|
|
Newbie
Joined: 28 Jan 2009 Posts: 6
|
Hi All,
Thanks for the responses. I did get this thing working....kind of.
I set the MQQueue CCSID to 37 and Encoding to 785 in my code.
Is there any way of achieving the same using websphere admin console?
Like always....appreciate your responses. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Feb 04, 2009 3:22 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
chades wrote: |
Hi All,
Thanks for the responses. I did get this thing working....kind of.
I set the MQQueue CCSID to 37 and Encoding to 785 in my code.
Is there any way of achieving the same using websphere admin console?
Like always....appreciate your responses. |
If you want to set the CCSID and encoding on your message by default, make sure you set it up on the QCF definition.
If you want the qmgr to translate your TextMessage to a target CCSID before putting it to the queue set the CCSID on the destination in JNDI...
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|