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 » Changing Pattern For Timestamp

Post new topic  Reply to topic
 Changing Pattern For Timestamp « View previous topic :: View next topic » 
Author Message
Vamsi Krishna
PostPosted: Sun Jul 06, 2014 10:46 pm    Post subject: Changing Pattern For Timestamp Reply with quote

Acolyte

Joined: 12 May 2014
Posts: 53

Hi, anyone can tell me how can I convert timestamp msg

2014-07-07T09:27:52.418968

to 20140707T0927 In Integration Bus

Using Cast function is it possible that we can perform like this
Anyone Please help
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jul 06, 2014 10:58 pm    Post subject: Re: Changing Pattern For Timestamp Reply with quote

Grand High Poobah

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

Vamsi Krishna wrote:
Hi, anyone can tell me how can I convert timestamp msg

2014-07-07T09:27:52.418968

to 20140707T0927 In Integration Bus

Using Cast function is it possible that we can perform like this
Anyone Please help


First you need to make sure the data is correctly read as a timestamp/GMTTIMESTAMP.
Then use a cast with format... or just define the outgoing format in xml / dfdl and have the broker apply at serialization...

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vamsi Krishna
PostPosted: Sun Jul 06, 2014 11:01 pm    Post subject: Reply with quote

Acolyte

Joined: 12 May 2014
Posts: 53

Thanks but i tried to use fromat but the time stamp is not changing can i have a code to perform this iam new to Integration bus
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sun Jul 06, 2014 11:05 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Vamsi Krishna wrote:
Thanks but i tried to use fromat but the time stamp is not changing can i have a code to perform this iam new to Integration bus


Please show us what code you tried to use. That way we can help you to help yourself.
_________________
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
View user's profile Send private message
Vamsi Krishna
PostPosted: Sun Jul 06, 2014 11:08 pm    Post subject: Reply with quote

Acolyte

Joined: 12 May 2014
Posts: 53

This is my code

DECLARE pattern CHARACTER 'yyyyMMdd''T''hmm';
DECLARE A CHARACTER InputRoot.XMLNSC.Trans.In;
SET OutputRoot.XMLNSC.Trans.C_time = CAST(A AS GMTTIMESTAMP FORMAT pattern);


and I have taken "20140707T0927" as character Input and i want to print it as TIMESTAMP or GMTTIMESTAMP with same Output "20140707T0927"
Back to top
View user's profile Send private message
Vamsi Krishna
PostPosted: Sun Jul 06, 2014 11:24 pm    Post subject: Reply with quote

Acolyte

Joined: 12 May 2014
Posts: 53

smdavies99 wrote:
Vamsi Krishna wrote:
Thanks but i tried to use fromat but the time stamp is not changing can i have a code to perform this iam new to Integration bus


Please show us what code you tried to use. That way we can help you to help yourself.


This is my code

DECLARE pattern CHARACTER 'yyyyMMdd''T''hmm';
DECLARE A CHARACTER InputRoot.XMLNSC.Trans.In;
SET OutputRoot.XMLNSC.Trans.C_time = CAST(A AS GMTTIMESTAMP FORMAT pattern);


and I have taken "20140707T0927" as character Input and i want to print it as TIMESTAMP or GMTTIMESTAMP with same Output "20140707T0927"
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Jul 07, 2014 12:23 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

ok, you are halfway there.

If we assume that

1) InputRoot.XMLNSC.Trans.In is a CHARACTER (xs:string) datatype and has a value of '2014-07-07T09:27:52.418968 '

2) OutputRoot.XMLNSC.Trans.C_time is also a CHARACTER datatype

3) You want to output C_tim in the format 'yyyyMMdd''T''hmm'

Then
1) The casting of the Input 'Trans.In' will need a format description all of its own
2) To keep it simple as you are learing, the ncast the input to a GMTTIMESTAMP varianle, then cast that to a CHAR.

Give it a try.
_________________
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
View user's profile Send private message
Vamsi Krishna
PostPosted: Mon Jul 07, 2014 12:31 am    Post subject: Reply with quote

Acolyte

Joined: 12 May 2014
Posts: 53

smdavies99 wrote:
ok, you are halfway there.

If we assume that

1) InputRoot.XMLNSC.Trans.In is a CHARACTER (xs:string) datatype and has a value of '2014-07-07T09:27:52.418968 '

2) OutputRoot.XMLNSC.Trans.C_time is also a CHARACTER datatype

3) You want to output C_tim in the format 'yyyyMMdd''T''hmm'

Then
1) The casting of the Input 'Trans.In' will need a format description all of its own
2) To keep it simple as you are learing, the ncast the input to a GMTTIMESTAMP varianle, then cast that to a CHAR.

Give it a try.

DECLARE pattern CHARACTER 'yyyyMMdd,T,hhmm';
DECLARE A CHARACTER InputRoot.XMLNSC.Trans.In;
SET OutputRoot.XMLNSC.Trans.C_time = CAST(A AS CHARACTER FORMAT pattern);

I had previously tried with this code and casting it to character Iam getting the desired result as in character
But my requirement is input 20140707T0927
it is a character I want the output in Timestamp or GMTTimetamp with output 20140707T0927
Back to top
View user's profile Send private message
smdavies99
PostPosted: Mon Jul 07, 2014 1:47 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Vamsi Krishna wrote:

But my requirement is input 20140707T0927[/b] it is a character I want the output in Timestamp or GMTTimetamp with output 20140707T0927


The FORMAT is for Character datatypes only. The format of a GMTTIMESTAMP or TIMESTAMP is fixed. you can't change that. The cast with a FORMAT tells broker to take the (lets say binary) format of the TIMESTAMP datatypes and create a character string with the format described.

Are you sure that you want OutputRoot.XMLNSC.Trans.C_tim to be a timestamp type data? The name 'c_tim' leads me to think you might want it to be a character type.

In anycase, you will still need to develop a format string to allow you to convert the input format into a Timestamp type. There are some pre-defineds ones that will do it for you.
The InfoCentre has a list of them. Search for 'Formatting and parsing dateTimes as strings'
_________________
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
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 » Changing Pattern For Timestamp
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.