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 » TIMESTAMP casting issue in AIX environment

Post new topic  Reply to topic
 TIMESTAMP casting issue in AIX environment « View previous topic :: View next topic » 
Author Message
vasumath
PostPosted: Wed Aug 12, 2009 7:24 am    Post subject: TIMESTAMP casting issue in AIX environment Reply with quote

Novice

Joined: 12 Feb 2007
Posts: 15

Hi All,

I am getting the timestamp from the input XML of format yyyyMMddhhmmss (for ex 20090807011747).

I am casting the same in ESQL using the below lines

DECLARE TargetDate TIMESTAMP;
SET TargetDate = CAST(SourceDate AS TIMESTAMP FORMAT 'yyyymmddHHmmss');
SET EditTimeStamp = CAST(TargetDate AS CHARACTER FORMAT 'yyyy-MM-dd HH:mm:ss');

In Windows the output is as expected i.e. 2009-08-07 01:17:47.

But in AIX, one hour is incremented with the input value i.e. the output is 2009-08-07 02:17:47.

I am not sure why there is a mismatch in re-formatting the timestamp in Windows and AIX.

I have tried my level best to fix this but I am not able to locate the issue. Please help me out to solve this issue


Thanks
Vasumathi
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Aug 12, 2009 7:27 am    Post subject: Re: TIMESTAMP casting issue in AIX environment Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

vasumath wrote:
I am not sure why there is a mismatch in re-formatting the timestamp in Windows and AIX.


Is there a difference between the time & regional settings on the 2 servers?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
vasumath
PostPosted: Fri Aug 14, 2009 5:17 am    Post subject: Reply with quote

Novice

Joined: 12 Feb 2007
Posts: 15

I have tried to change the Regional setting in Windows to see some difference in the casting...

But there was no change....

Can you please let me know if there is another option?
Back to top
View user's profile Send private message
nvenkatesh
PostPosted: Fri Aug 14, 2009 6:28 am    Post subject: Reply with quote

Apprentice

Joined: 29 Jan 2007
Posts: 45

Hi,

I think the problem might be the day light saving time(DST). Please check the below link
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/au16532_.htm

under the heading "The CAST function does not provide the expected DST offset for non-GMT time zones"

and

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/ak05616_.htm

where the below is specified

For CAST to calculate the offset correctly, the time passed into CAST must have a time zone associated with it, as a Z parameter. If no time zone is associated with the value passed, the time is converted into GMT time; it is not treated as a local time stamp.

Its my guess that your local time is GMT and your code is working in the windows machine correctly.
Also you haven't used time zone in your code.

Thanks,
Venkatesh[/i]
Back to top
View user's profile Send private message
chrisgclark
PostPosted: Tue Oct 20, 2009 3:11 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Hi all,

I also have this issue and can not seem to solve it.

I have the following code and my servers are running BST time. (On AIX the 'date' command shows BST time and BST timezone. I'm running Broker 6.1.0.2.)

Code:
SET orfer.CURRENT_TIMESTAMP = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'I')


On windows this shows 2009-10-20T11:31:23.001+01:00 (i.e. correct timezone, correct BST time)
but on AIX it shows 2009-10-20T11:31:23.001+00:00 (i.e. wrong timezone, but correct BST time)

I can't figure out why on AIX the timezone is showing as GMT, not BST. After research I tried changing the AIX TZ environment variable to Europe/London, but this changed the output on AIX to:

2009-10-20T10:31:23.001+01:00 (i.e. correct timezone, but wrong time).

I'm not sure how to implement the following...
Quote:
'For CAST to calculate the offset correctly, the time passed into CAST must have a time zone associated with it, as a Z parameter. '


I also tried the following but still no joy:
Code:
SET orfer.CURRENT_TIMESTAMP = CAST(CURRENT_TIMESTAMP  + LOCAL_TIMEZONE AS CHARACTER FORMAT 'I')


Can anyone help please.

Chris
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Oct 20, 2009 4:34 am    Post subject: Reply with quote

Grand High Poobah

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

Do not pass CURRENT_TIMESTAMP to your cast.
Pass CURRENT_GMTTIMESTAMP.

This is what the previous posts told you to do...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
chrisgclark
PostPosted: Tue Oct 20, 2009 6:21 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

fjb_saper, thanks for your comment, however I tried using CURRENT_GMTTIMESTAMP with tz=Europe/London on AIX, however this shows timestamp as:

2009-10-20T10:31:23.001+00:00 - GMT time, GMT timezone.

What I need is BST time, BST timezone.

i.e. I need:

2009-10-20T11:31:23.001+01:00

I can get this on Windows with

Code:
SET orfer.CURRENT_TIMESTAMP = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'I')


but not on AIX. I don't understand why this does not work on AIX.

Any other suggestions?


Last edited by chrisgclark on Tue Oct 20, 2009 6:36 am; edited 1 time in total
Back to top
View user's profile Send private message
Gaya3
PostPosted: Tue Oct 20, 2009 6:25 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

think about a fix too


http://www-01.ibm.com/support/docview.wss?rs=849&uid=swg27015915

IC51484 - BROKER ALTERS THE CURRENT_TIMESTAMP IN ITS ENVIRONMENT
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
chrisgclark
PostPosted: Tue Oct 20, 2009 7:58 am    Post subject: Reply with quote

Apprentice

Joined: 26 Mar 2009
Posts: 35

Gaya3 - thanks for the link... we've upgraded one of our servers to Broker6.1.0.5 so I'll check if this is still an issue on 6.1.0.5. I'll let you know...
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 21, 2009 1:03 am    Post subject: Reply with quote

Grand High Poobah

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

chrisgclark wrote:
fjb_saper, thanks for your comment, however I tried using CURRENT_GMTTIMESTAMP with tz=Europe/London on AIX, however this shows timestamp as:

2009-10-20T10:31:23.001+00:00 - GMT time, GMT timezone.

What I need is BST time, BST timezone.

i.e. I need:

2009-10-20T11:31:23.001+01:00

I can get this on Windows with

Code:
SET orfer.CURRENT_TIMESTAMP = CAST(CURRENT_TIMESTAMP AS CHARACTER FORMAT 'I')


but not on AIX. I don't understand why this does not work on AIX.

Any other suggestions?


So it shows up as the correct time.
Now you can cast this to type TIMESTAMP.
Check that it adds the difference. If not there is a variable that does hold this information (difference of current tz to gmt).
You should then be able to cast your variable from TIMESTAMP to CHAR.
You might have to add the tz info +xhours by appending it to the string.

Note the easier way to do this might well be

cast (CURRENT_TIMESTAMP) to string (don't add tz in format)
append to string the difference due to tz.


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » TIMESTAMP casting issue in AIX environment
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.