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 » Mainframe, CICS, TXSeries » Double byte characters - aka - Japanese characters

Post new topic  Reply to topic Goto page 1, 2  Next
 Double byte characters - aka - Japanese characters « View previous topic :: View next topic » 
Author Message
ravishankarn
PostPosted: Tue Feb 06, 2007 5:00 am    Post subject: Double byte characters - aka - Japanese characters Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Dear all,

This is from one of the members of a large pool of developers who are trying their best for the last couple of weeks to get the folowing success. Kindly help. Your exper replies are appreciated.

We have front end J2EE application. So we have EJBs. The EJB calls a MessageAdmin class, which has got two methods, putMessage which will put message into MQ and getMessage which will retrieve message from MQ. From MQ, TS will pick up the message and depending on the bind program, it will connect to CICS and get the messages or submits the messages wherever necessary. MQ in\s in AIX bos. CICS of course in OS2/390.

J2EE encoding, inclusive of Websphere App Server is UTF-8.
MQ CCSID setting (MQMessage.setEncoding) is 942 - for Japanese
When message goes into queue and comes back, both encoding is 942.

We tried with many different values, but results in vain. Can anyone suggest possible reason and remedy? WHat we should do to support double byte? Or what we should do to work for any character set in the world, rather than changing for each country?

We have a second part - rather than using any such encoding values, if I use Java API to convert UTF-8 to EBCDIC (while putting message) and revers when getting message, will it work ? If not why ? Need some fundamentals please.

It will be a great help to all of us.

Warmest regards,
Shank
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Feb 06, 2007 5:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You should make sure to setEncoding before writing data into the message object.

You should make sure to use a TextMessage object, and not a BytesMessage or etc.

You should not write your messages in EBCDIC.

You should confirm that there is a valid translation between 942 and the EBCDIC encoding being used on the mainframe.

You should confirm that the mainframe can process the double-byte characters.

You should examine the contents of the message on a local queue on AIX, and make sure that that is correct, before you try to send them to mainframe.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ravishankarn
PostPosted: Wed Feb 07, 2007 6:46 am    Post subject: Double byte character set - aka Japanese :- not working Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Dear all and Jeffflowery,

No luck. Perhaps, let me send the getMessage code piece here, which does getting a message. Counterpart is putMessage. Please help, as there is no luck on our side..

Warmest regards,
Ravion

Please note that objMessage is of type MQMessage and we had set objMessage.characterSet = 942 already.

public static String getMessage(byte[] sMessageId) throws Exception
{
MQQueueManager objQMgr = null;
MQQueue objGetQueue = null;

MQMessage objMessage = null;
String sMsg = null;

try
{
objQMgr = new MQQueueManager(sQMgrName);
objGetQueue = objQMgr.accessQueue(sGetQName,MQC.MQOO_INPUT_AS_Q_DEF);
objMessage = new MQMessage();
objMessage.correlationId = sMessageId;

MQGetMessageOptions objGMO = new MQGetMessageOptions();
objGMO.options = MQC.MQGMO_WAIT;
objGMO.options = MQC.MQOO_INPUT_AS_Q_DEF;
objGMO.waitInterval = iWaitInterval;
objGMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;

objGetQueue.get(objMessage,objGMO);
byte[] byteMessage = new byte[objMessage.getDataLength()];
objMessage.readFully(byteMessage);
sMsg = new String(byteMessage,"942");
//sMsg = objMessage.readString(objMessage.getMessageLength());
objGetQueue.close();
objQMgr.disconnect();
}
catch (MQException ex)
-------
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 07, 2007 6:59 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

That's not JMS.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ravishankarn
PostPosted: Wed Feb 07, 2007 1:17 pm    Post subject: Could nt get you Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Hi Jefflowery,

Could not get what you meant. From EJB we write the above code to put the message to queue. From the queue TS program will pick it submits to the AOR.

Thanks and regards,
Ravi
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 07, 2007 1:26 pm    Post subject: Re: Could nt get you Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ravishankarn wrote:
Hi Jefflowery,

Could not get what you meant. From EJB we write the above code to put the message to queue. From the queue TS program will pick it submits to the AOR.

Thanks and regards,
Ravi

You are talking about an EJB which fits nicely into the JMS model but are not using MQ JMS to go with your model but MQ Base ???

Any specific reason???
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ravishankarn
PostPosted: Wed Feb 07, 2007 2:04 pm    Post subject: YEah understood Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Hi Jeflowey,

No specific reason. I would say, it is because the code is there serving many different countires over the past few years. And now we are faced with DBCS support requirement.

Well, if it is not JMS, and is MQ specific, any clue on where can be the issue? Thanks a lot.
Best
Ravion
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Feb 07, 2007 2:17 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Please pay attention to who you are replying to.

Please change your Get code to specify MQGMO_CONVERT.

Please change your PUT code to specify MQFMT_STRING.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 07, 2007 2:18 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

You are not specifying MQFMT_STRING, you are not specifying the convert flag on the MQGet options. Are you sending text at all?

You cannot send mixed text / number records (binary or comp-x).

Read the manuals...(programer)

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Wed Feb 07, 2007 2:19 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

fjb_saper wrote:
You cannot send mixed text / number records (binary or comp-x).


To clarify that a bit more, too.

You must send the ENTIRE message data in the same character set.

Or you must manually break apart the bytes you get back into pieces based on what CCSID they are in, and convert those to strings using the correct CCSID.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ravishankarn
PostPosted: Wed Feb 07, 2007 4:47 pm    Post subject: OK, Let me try today with these Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Hi all,

Thanks for the comments. Please let me try today with your valuable advise. Let me get back to you..

Best
Ravion
Back to top
View user's profile Send private message
ravishankarn
PostPosted: Fri Feb 09, 2007 6:15 am    Post subject: So sad that We cannot get it working Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Dear all,

When I gave MQGMO_CONVERT option, its not giving the expected result. Is this mandatory ? Some conversionbufferexception is coming.Pls advise

When I gave MQFMT_STRING, header information is not going. I read from certain docs that we should give CICS, instead of STRING to have header also to be included.

I am posting our entire code below:-

import com.ibm.mq.*;

public class CustomQueueManager
{


private static String sQMgrName = A;
private static String sPutQName = B;
private static String sGetQName = C;
private static String sReplyToQMgrName = D;
private static String sReplyToQName = E;
private static int sTimeout = 3000000;
private static int iMaxConn = 10;
private static int iMaxUnusedConn =10;
public static int iWaitInterval = 120000;

private static MQSimpleConnectionManager objConnMgr = null;
private static MQPoolToken objPoolToken = null;
public static void closeAll() throws Exception
{
MQEnvironment.removeConnectionPoolToken(objPoolToken);
;
}
public static String execute(CustomMessage objEIMsg) throws Exception
{
String sReply = null;
byte[] messageId = putMessage(objEIMsg);
sReply = getMessage(messageId);
return sReply;
}
public static String getMessage(byte[] sMessageId) throws Exception
{
MQQueueManager objQMgr = new MQQueueManager(sQMgrName);
MQQueue objGetQueue = objQMgr.accessQueue(sGetQName,MQC.MQOO_INPUT_AS_Q_DEF);


MQMessage objMessage = null;
String sMsg = null;

try {

objMessage = new MQMessage();
objMessage.correlationId = sMessageId;

MQGetMessageOptions objGMO = new MQGetMessageOptions();

objGMO.options = MQC.MQGMO_WAIT;
objGMO.options = MQC.MQOO_INPUT_AS_Q_DEF;
objGMO.waitInterval = iWaitInterval;
objGMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;

objGetQueue.get(objMessage,objGMO);
sMsg = objMessage.readString(objMessage.getMessageLength());



objMessage.characterSet = XXXXX;// *********PLEASE NOTE*****
objGMO.options = MQC.MQGMO_WAIT | MQC.MQOO_INPUT_AS_Q_DEF;
objGMO.waitInterval = iWaitInterval;
objGMO.matchOptions = MQC.MQMO_MATCH_CORREL_ID;
objGetQueue.get(objMessage,objGMO);
byte[] byMessage = new byte[objMessage.getDataLength()];
objMessage.readFully(byMessage);
sMsg = new String( byMessage, "YYYYY");// ************PLEASE NOTE *********


}
catch (MQException ex) {

throw new MQException(ex.completionCode, ex.reasonCode,"getMessage");

}finally
{
objGetQueue.close();
objQMgr.disconnect();
}

return sMsg;
}
public static void openAll() throws Exception {
System.out.println("Inside Open All Method ");

objConnMgr = new MQSimpleConnectionManager();

objConnMgr.setActive(MQSimpleConnectionManager.MODE_AUTO);

objConnMgr.setTimeout(sTimeout);

objConnMgr.setMaxConnections(iMaxConn);

objConnMgr.setMaxUnusedConnections(iMaxUnusedConn);

MQEnvironment.setDefaultConnectionManager(objConnMgr);

objPoolToken = MQEnvironment.addConnectionPoolToken();

}
public static byte[] putMessage(CustomMessage objEIMsg) throws Exception
{

MQEnvironment.hostname="193.137.122.229";
// MQEnvironment.port =14000;
MQEnvironment.port =1415;
MQEnvironment.channel="SYS.DEM.SVRCONNME";
MQEnvironment.userID="***";
MQEnvironment.password="**";



MQQueueManager objQMgr = new MQQueueManager(sQMgrName);
MQQueue objPutQueue = objQMgr.accessQueue(sPutQName,MQC.MQOO_OUTPUT | MQC.MQOO_SET_ALL_CONTEXT);


MQMessage objMessage = new MQMessage();

objMessage.userId=objEIMsg.getUserID();



try {

// MQMD
objMessage.format = MQC.MQFMT_CICS;
objMessage.encoding= (MQC.MQENC_INTEGER_NORMAL |MQC.MQENC_DECIMAL_NORMAL |MQC.MQENC_FLOAT_IEEE_NORMAL);
objMessage.characterSet= ZZZZZ ; // *********PLEASE NOTE *********
objMessage.expiry = Integer.parseInt("2000");

// MQCIH
objEIMsg.setEncoding(objMessage.encoding);
objEIMsg.setCodedCharSetId(objMessage.characterSet);
objEIMsg.buildMQCIH(objMessage);

objMessage.writeString(objEIMsg.getProgramName());
// Req Commarea
if (objEIMsg.getWAIA() != null) {
objMessage.writeString(objEIMsg.getWAIA());

}else{
//some code
}


if (objEIMsg.isNewSession()){
objMessage.correlationId = MQC.MQCI_NEW_SESSION;

}else{
objMessage.correlationId = objEIMsg.getMessageID();
}
objMessage.replyToQueueName = sReplyToQName;

objMessage.replyToQueueManagerName = sReplyToQMgrName;
// Put message queue options
MQPutMessageOptions objPMO = new MQPutMessageOptions();
objPMO.options = MQC.MQPMO_SET_IDENTITY_CONTEXT;
objPutQueue.put(objMessage,objPMO);
objEIMsg.setMessageID(objMessage.messageId);

}
catch (MQException eMQ) {

eMQ.printStackTrace();

}finally
{
objPutQueue.close();
objQMgr.disconnect();

}
return objMessage.messageId;
}

}


Basically what we need is the three values XXXXX, YYYYY and ZZZZZ above. The code is serving for many applications in different regions, with Greek, Euro, US English etc. But the need for double byte is the first one. Is there anything else we need to put in. Can anyone please help us? Thanks a million.

Sample values I tried:-
XXXXX = 932
YYYYY = 943
ZZZZZ = 500

I have gone through the section below as well-
http://publib.boulder.ibm.com:80/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqzak.doc/aq30s17.htm

I even could not get why we need two different values for XXXXX and YYYYY. Becasue what I use for encode should be what I use for decode. Am I correct ?

Best Ravion
Back to top
View user's profile Send private message
ravishankarn
PostPosted: Sat Feb 10, 2007 2:47 pm    Post subject: Please help... Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Dear all,

Please give some hints on the above problem. We have tried a lot for resolving this..

Thanks and regards,
Ravi
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Feb 10, 2007 7:09 pm    Post subject: Re: Please help... Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ravishankarn wrote:
Dear all,

Please give some hints on the above problem. We have tried a lot for resolving this..

Thanks and regards,
Ravi

Well if you want the CICS header you will have to chain the headers:
1) MQMD with format MQFMT_CICS...
2) CICS header with MQFMT_STRING...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ravishankarn
PostPosted: Sun Feb 11, 2007 12:27 pm    Post subject: Lemme Try AGain Reply with quote

Novice

Joined: 06 Feb 2007
Posts: 14

Dear all.

As fjb-saper had advised, we will make a try again today. Hoping for the best:)

Thanks and regards,
Ravi
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » Mainframe, CICS, TXSeries » Double byte characters - aka - Japanese characters
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.