Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2650
  • Last Modified:

jms_bytes message type - trying to decode message body...

i'm receiving a message from MQ - it originated on a mainframe.  the message as it reads in my onMessage is this:

JMS Message class: jms_bytes
  JMSType:         null
  JMSDeliveryMode: 2
  JMSExpiration:   0
  JMSPriority:     0
  JMSMessageID:    ID:c3e2d840d4d8f1d74040404040404040bcd3a02452f62407
  JMSTimestamp:    1112884972650
  JMSCorrelationID:null
  JMSDestination:  null
  JMSReplyTo:      null
  JMSRedelivered:  false
  JMSXDeliveryCount:1
  JMS_IBM_MsgType:8
  JMSXAppID:JDONTHF                    
  JMS_IBM_Format:        
  JMS_IBM_Encoding:785
  JMS_IBM_PutApplType:2
  JMS_IBM_Character_Set:37
  JMSXUserID:jdon        
  JMS_IBM_PutTime:14425265
  JMS_IBM_PutDate:20050407
Integer encoding: 1, Floating point encoding 768
e3c1d3c8d6d3c45c5c5c5c5c5c5c5c5cf0f0f2f0f0f0f1f44c849485a2a28187856ef0f1f2f14c84
888581846e4c849683a3a89785c9846e88969384899587408685854c61849683a3a89785c9846e4c
a296a4998385c9846e9481899586998194854c61a296a4998385c9846e4c8696999481a3c9846e86
89a785846093859587a38840a385a7a34c618696999481a3c9846e4c6184888581846ef0f0f9f44c
848496834085a7a38599958193c49683c9847e7fc8c6f0f0f0f7f1c2c2f5f2f0f0f5f0f6f1f27f40
85a7a38599958193e58599a2899695c9847e7f868999a2a3409596a38983857f6e4c5abac3c4c1e3
c1ba40404040404040f0f0f2f4c4c8c6f0f0f0f7f1c2c2f5f2f0f0f5f0f6f1f2e8f0f3f0f5c8e7e8
e940c1c4e5c5d9e3c9e2c9d5c7404040404040404040404040404040404040404040f1f2f340e64b
40f1f8e3c840e2e3d9c5c5e3404040404040404040404040d5c5e640e8d6d9d26b40d5e840f1f0f0
f0f94040404040404040404040404040404040404040404040404040404040404040404040404040
...

I've tried to decode the darn thing w/ASCII, UTF8, Unicode, IBM437...

               BytesMessage tmpMsg = (BytesMessage)message
               int writeIndex = 0;
               byte[] buffer = new byte[2048];
               byte[] body = new byte[0];

           while (true)
                    {
                        int numBytesRead = tmpMsg.readBytes(buffer);
                        if (numBytesRead == -1)
                        {
                            break;
                        }

                        byte[] tmp = new byte[body.length + numBytesRead];
                        System.arraycopy(body,0,tmp,0,body.length);
                        System.arraycopy(buffer,0,tmp,body.length,numBytesRead);
                        body = tmp;
                    } //end while    

               String msgBody = new String(body, "<encoding>");

no dice.  i get a garbage string every time.  can anyone shed some light?  thanks!
0
nojyarg
Asked:
nojyarg
  • 2
1 Solution
 
Jim CakalicSenior Developer/ArchitectCommented:
> JMS_IBM_Character_Set:37
implies to me that it is EBCDIC. According to Java 1.4 docs, (http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html), it would appear that CP037 is a supported encoding. Try using:

    String msgBody = new String(body, "Cp037");

Regards,
Jim Cakalic
0
 
nojyargAuthor Commented:
Thanks, Jim!  That did it.  Guess i should have scoured the java supported encodings doc a bit more...
0
 
Jim CakalicSenior Developer/ArchitectCommented:
Believe me, it took a while to find, and I had a pretty good idea of what I was looking for.

Jim
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now