Author |
Message
|
saimahesh |
Posted: Wed Dec 13, 2017 2:00 pm Post subject: Set PutDate,and PutTime of MQMD in Java compute Node |
|
|
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 |
|
 |
fjb_saper |
Posted: Wed Dec 13, 2017 6:09 pm Post subject: Re: Set PutDate,and PutTime of MQMD in Java compute Node |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
saimahesh |
Posted: Thu Dec 14, 2017 1:13 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Thu Dec 14, 2017 2:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
saimahesh |
Posted: Thu Dec 14, 2017 4:11 am Post subject: |
|
|
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 |
|
 |
saimahesh |
Posted: Fri Dec 15, 2017 1:01 am Post subject: |
|
|
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 |
|
 |
joebuckeye |
Posted: Fri Dec 15, 2017 5:24 am Post subject: |
|
|
 Partisan
Joined: 24 Aug 2007 Posts: 365 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 |
|
 |
saimahesh |
Posted: Fri Dec 15, 2017 7:09 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri Dec 15, 2017 7:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 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 |
|
 |
rekarm01 |
Posted: Fri Dec 15, 2017 10:17 am Post subject: Re: Set PutDate,and PutTime of MQMD in Java compute Node |
|
|
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 |
|
 |
|