|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
casting error at date MMM format in case of WMB8 |
« View previous topic :: View next topic » |
Author |
Message
|
csongebalazs |
Posted: Mon Nov 18, 2013 5:04 am Post subject: casting error at date MMM format in case of WMB8 |
|
|
Voyager
Joined: 30 Jan 2004 Posts: 78
|
Hi!
We have an application, which code contains the following part:
Code: |
CAST(CAST(nyers AS DATE FORMAT 'dd-MMM-yyyy') AS CHAR FORMAT 'yyyyMMdd') |
The input string for example a 16-NOV-2013.
Under WMB7, everything is fine, CAST can be done.
But under WMB8 i got a cast exception:
Code: |
(0x03000000:NameValue):Text = 'No short month name' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '16-NOV-2013' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'dd-MMM-yyyy' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'NOV' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'MMM' (CHARACTER) |
I tried to chnage regional language setting, but that did not help.
I tried to change NOV to Nov or nov, but failed too.
Finally 18-NOV.-2013 has been casted.
In broker documentation there isn't any word about . after month name. Is it some kind of bug of WMB8, right? |
|
Back to top |
|
 |
shinchan |
Posted: Mon Nov 18, 2013 10:29 am Post subject: Re: casting error at date MMM format in case of WMB8 |
|
|
Newbie
Joined: 18 Nov 2013 Posts: 6
|
csongebalazs wrote: |
Hi!
We have an application, which code contains the following part:
Code: |
CAST(CAST(nyers AS DATE FORMAT 'dd-MMM-yyyy') AS CHAR FORMAT 'yyyyMMdd') |
The input string for example a 16-NOV-2013.
Under WMB7, everything is fine, CAST can be done.
But under WMB8 i got a cast exception:
Code: |
(0x03000000:NameValue):Text = 'No short month name' (CHARACTER)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = '16-NOV-2013' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'dd-MMM-yyyy' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'NOV' (CHARACTER)
)
(0x01000000:Name ):Insert = (
(0x03000000:NameValue):Type = 5 (INTEGER)
(0x03000000:NameValue):Text = 'MMM' (CHARACTER) |
I tried to chnage regional language setting, but that did not help.
I tried to change NOV to Nov or nov, but failed too.
Finally 18-NOV.-2013 has been casted.
In broker documentation there isn't any word about . after month name. Is it some kind of bug of WMB8, right? |
hi, try this:
Code: |
CAST(CAST(REPLACE('16-NOV-2013','-','/') AS DATE FORMAT 'dd/MMM/yyyy') AS CHAR FORMAT 'yyyyMMdd');
|
there are some problem with '-'
Greetings |
|
Back to top |
|
 |
csongebalazs |
Posted: Tue Nov 19, 2013 6:06 am Post subject: |
|
|
Voyager
Joined: 30 Jan 2004 Posts: 78
|
Changing - t / did not help, got same exception. |
|
Back to top |
|
 |
dogorsy |
Posted: Wed Nov 20, 2013 11:44 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
csongebalazs wrote: |
Changing - t / did not help, got same exception. |
The doc says:
Quote: |
MMM named month Text Jan, Feb |
so, try the string Nov instead of NOV
I have just tried
Code: |
DECLARE nyers CHAR '16-NOV-2013';
SET OutputRoot.XMLNSC.Test.d = CAST(CAST(nyers AS DATE FORMAT 'dd-MMM-yyyy') AS CHAR FORMAT 'yyyyMMdd'); |
and it works fine for me. wmb 8.0.0.2, I got
Code: |
<Test>
<d>20131116</d>
</Test> |
|
|
Back to top |
|
 |
csongebalazs |
Posted: Thu Nov 21, 2013 12:19 am Post subject: |
|
|
Voyager
Joined: 30 Jan 2004 Posts: 78
|
Hi,
As I wrote at the start, I tried NOV, Nov, nov. None of those was good. It worked only with NOV.. /We figured out the presence of extra dot, when tried to do an oposit cast, mean casting current date to string with that format, and we saw that dot./ This extra dot may be comes from some kind of regional settings, I think, but don't know how can I manipulate those settings for working environment. I tried english united states and hungarian regional language (including date time) setting, but no success.
But it worked with WMB7, code did not change and it's not working on WMB8.0.0.2, so it still seems some kind of bug or some kind of defect of the documentation, which not mention secret behaviour behind the CAST.
This problem persists on Win 2008 server. Are u working on same OS?
And it doesn't work in our customer environment, and I asked my ex-college in other company to try it, and he got same problem. He tested it on win 8.
I replaced this CAST with a stupid CASE, but I still interesting about, what couse my problem. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Nov 21, 2013 1:16 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
I just tried this on a VM running Windows Server 2008 R2
Code: |
CREATE PROCEDURE DoStuff() BEGIN
declare cNow CHARACTER '21-NOV-2013';
declare cThen CHAR;
set cThen = CAST(CAST(cNow AS DATE FORMAT 'dd-MMM-yyyy') AS CHAR FORMAT 'yyyyMMdd');
set OutputRoot.XMLNSC.Data.t1 = cNow;
set OutputRoot.XMLNSC.Data.t2 = cThen;
END;
|
gives
Code: |
<Data>
<t1>21-NOV-2013</t1>
<t2>20131121</t2>
</Data>
|
It might be your local settings. Mine has (to my surprise) somehow been reset to EN-US. It was EN-GB I shall change it back. I blame the patches from MS. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Nov 21, 2013 2:49 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
csongebalazs wrote: |
Hi,
As I wrote at the start, I tried NOV, Nov, nov. None of those was good. It worked only with NOV.. /We figured out the presence of extra dot, when tried to do an oposit cast, mean casting current date to string with that format, and we saw that dot./ This extra dot may be comes from some kind of regional settings, I think, but don't know how can I manipulate those settings for working environment. I tried english united states and hungarian regional language (including date time) setting, but no success.
But it worked with WMB7, code did not change and it's not working on WMB8.0.0.2, so it still seems some kind of bug or some kind of defect of the documentation, which not mention secret behaviour behind the CAST.
This problem persists on Win 2008 server. Are u working on same OS?
And it doesn't work in our customer environment, and I asked my ex-college in other company to try it, and he got same problem. He tested it on win 8.
I replaced this CAST with a stupid CASE, but I still interesting about, what couse my problem. |
I am using Windows 7 and WMB8.0.0.2 and have used CAST for dates since the WMB8.0.0.1 was released without problem.
Maybe you need to raise a PMR |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|