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 » WebSphere Message Broker (ACE) Support » Set PutDate,and PutTime of MQMD in Java compute Node

Post new topic  Reply to topic
 Set PutDate,and PutTime of MQMD in Java compute Node « View previous topic :: View next topic » 
Author Message
saimahesh
PostPosted: Wed Dec 13, 2017 2:00 pm    Post subject: Set PutDate,and PutTime of MQMD in Java compute Node Reply with quote

Novice

Joined: 13 Dec 2017
Posts: 13

Hi,
I am trying to restore the MQMD Header for a message in Java Compute Node.I am Facing problem while trying to restore the 'putDate' and 'putTime' fields Iam getting 'invalid type name value' error even though I was using gregorian calender for this. Please help me out.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 13, 2017 6:09 pm    Post subject: Re: Set PutDate,and PutTime of MQMD in Java compute Node Reply with quote

Grand High Poobah

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

saimahesh wrote:
Hi,
I am trying to restore the MQMD Header for a message in Java Compute Node.I am Facing problem while trying to restore the 'putDate' and 'putTime' fields Iam getting 'invalid type name value' error even though I was using gregorian calender for this. Please help me out.

And the corresponding fields in the MQMD are defined as ?
Did you make sure you defined the Calendar in the GMT time zone?

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
saimahesh
PostPosted: Thu Dec 14, 2017 1:13 am    Post subject: Reply with quote

Novice

Joined: 13 Dec 2017
Posts: 13

In MQMD PutDate and PutTime fields are defined as java.util.GregorianCalendar. In restoring ,converted String date/time to java.util.GregorianCalendar set to PutDate/time.

Yes,Calendar in the GMT time zone.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 14, 2017 2:14 am    Post subject: Reply with quote

Grand High Poobah

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

saimahesh wrote:
In MQMD PutDate and PutTime fields are defined as java.util.GregorianCalendar. In restoring ,converted String date/time to java.util.GregorianCalendar set to PutDate/time.

Yes,Calendar in the GMT time zone.

I don't think so. I did not ask you what was returned from Java.
If you look at the MQMD C definition, what are the fields defined as?
String 6?, string 8?
What do they show up as if you look at them with rfhutil?
You may have to define a SimpleDateFormat in the GMT time zone to write the date/time out to the field...
Now if you can ensure that you have the MQMD parser as a field parser you may keep using a Date and maybe Time class... / Calendar class...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
saimahesh
PostPosted: Thu Dec 14, 2017 4:11 am    Post subject: Reply with quote

Novice

Joined: 13 Dec 2017
Posts: 13

As per MQMD C definition field defined for PutDate as MQCHAR8.

We have tried SimpleDateFormat in the GMT time zone.JVM has thrown 'invalid type name value' exception.

For PutDate, set java.util.Date type in JCN. Got 'invalid type name value' exception at this statement.

Tried with GregorianCalender() as well.Got same exception.
Back to top
View user's profile Send private message
saimahesh
PostPosted: Fri Dec 15, 2017 1:01 am    Post subject: Reply with quote

Novice

Joined: 13 Dec 2017
Posts: 13

Hi Team,
Could you please provide your valuable suggestions to set PutDate and PutTime of MQMD in JCN.In restore the MQMD headers ,got 'invalid type name value' java.util gregorian calender while set the date and time.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri Dec 15, 2017 5:24 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 364
Location: Columbus, OH

Stop trying to use Java date types. Lookup what characters the MQMQ is expecting in those fields and in what order. I would bet it is not the same as a Java type.

And show your code. Otherwise we are all guessing at what you are really doing.
Back to top
View user's profile Send private message
saimahesh
PostPosted: Fri Dec 15, 2017 7:09 am    Post subject: Reply with quote

Novice

Joined: 13 Dec 2017
Posts: 13

Hi ,
We are trying following java code to set the putDate and putTime.
Code:

try {

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss.SSS");

Date putDate = dateFormat.parse(MBMessageUtils.getElementValue(mqmdHeader,
"PutDate", false, false));

Date putTime = timeFormat.parse(MBMessageUtils.getElementValue(mqmdHeader,
"PutTime", false, false));
GregorianCalendar calender = new GregorianCalendar();
GregorianCalendar calender1 = new GregorianCalendar();
calender.setTime(putDate);
Object cal = calender;
calender1.setTime(putTime);
String puttimefinal = timeFormat.format(putTime);
// mqmdHeaderElement.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,
// "PutDate",calender);
mqmdHeaderElement.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,
"PutDate",cal);

//
mqmdHeaderElement.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,
"PutTime",calender1);
} catch (ParseException e) {
}


Got following exception.

Code:

Function:CHARACTER:setValue
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:4373
Text:CHARACTER:Invalid element value type
Insert
Type:INTEGER:5
Text:CHARACTER:java.util.GregorianCalendar
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 15, 2017 7:43 am    Post subject: Reply with quote

Grand High Poobah

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

I am not sure the date and time format match.
On the other hand I don't believe that the return form when you read the field on a message would be a Calendar object. More like a Date object perhaps?

So you could try setting the value by passing a Date object, or get the format right and set the text value.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Fri Dec 15, 2017 10:17 am    Post subject: Re: Set PutDate,and PutTime of MQMD in Java compute Node Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

saimahesh wrote:
Code:
// ...
GregorianCalendar calender = new GregorianCalendar();
GregorianCalendar calender1 = new GregorianCalendar();
// ...
Object cal = calender;
// ...
mqmdHeaderElement.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "PutDate", cal);
//
mqmdHeaderElement.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "PutTime", calender1);

Check out the IIB Java user-defined extensions API. For MbElement.createElementAsLastChild(), the value Object must be one of the following types:
  • MbDate
  • MbTime
  • MbTimestamp
  • Boolean
  • byte[]
  • String
  • Integer
  • Double
  • BitSet
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Set PutDate,and PutTime of MQMD in Java compute Node
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.