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 » SUBSTRING

Post new topic  Reply to topic
 SUBSTRING « View previous topic :: View next topic » 
Author Message
Dhiren
PostPosted: Tue Dec 20, 2005 5:44 pm    Post subject: SUBSTRING Reply with quote

Novice

Joined: 27 Jan 2005
Posts: 17

Hi,

I have a CAST and a SUBSTRING funtion here ....

SET inDate=SUBSTRING(CAST (Header.Order.ReferenceDate AS CHAR) FROM 12 FOR 19);

If the source field ReferenceDate is of date type (yyyy-mm-dd hh:mi:ss). The above cast is definitely worng as from the 12th position there is no enough place for 19 length.


I tried this in a sample code and found out that field 'inDate' is assigned with the whole "ReferenceDate" (without substring).... does anybody know why it behaves like this ? shouldnt it tell me that the Substring function used here is wrong instead ?
Back to top
View user's profile Send private message Yahoo Messenger
mgk
PostPosted: Wed Dec 21, 2005 1:56 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

The answer should be a substring from 12 until the end of the source string (assuming the src is > 12 and < 19 in length).

Can you post your sample code, sample input data and results, along with the version and fix pack of the broker please.
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Dec 21, 2005 9:34 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Well, it the field "Header.Order.ReferenceDate" is declared as a WBI Timestamp, then your code looks OK. Because when you CAST a Timestamp as CHAR, you get a preceeding literal of: TIMESTAMP.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Dhiren
PostPosted: Wed Dec 21, 2005 4:40 pm    Post subject: Reply with quote

Novice

Joined: 27 Jan 2005
Posts: 17

Hi EddieA,
Looks like this one almosts solves my problem. Could you please tell me exactly what happens when u CAST a Timestamp as CHAR ?

Lets say I have a date comming in as yyyy-mm-dd hh:mi:ss , and if i cast this to char then what is the reult ? Like u said that u'l get a preceeding literal of: TIMESTAMP. Then will it be TIMESTAMP yyyy-mm-dd hh:mi:ss ?

Thanks for the reply guys..

Cheers
Back to top
View user's profile Send private message Yahoo Messenger
JT
PostPosted: Wed Dec 21, 2005 5:16 pm    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

In the future, there's no need to wait for a reply, you can discover the answer yourself by searching the Information Center: http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ak05680_.htm?

Quote:
CAST TIMESTAMP to CHARACTER
The result is a string conforming to the definition of a TIMESTAMP literal, whose interpreted value is the same as the source timestamp value.

For example:
CAST(TIMESTAMP '2002-10-05 09:24:15' AS CHARACTER)

returns
TIMESTAMP '2002-10-05 09:24:15'
Back to top
View user's profile Send private message
EddieA
PostPosted: Wed Dec 21, 2005 5:18 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
Lets say I have a date comming in as yyyy-mm-dd hh:mi:ss , and if i cast this to char then what is the reult

If it's "coming in" to the broker, then it's almost certainly already character, so the result will be: yyyy-mm-dd hh:mi:ss

You will only get the TIMESTAMP literal if you CAST a field that is DECLAREd as a TIMESTAMP.
Quote:
Then will it be TIMESTAMP yyyy-mm-dd hh:mi:ss

Maybe IBM introduced the Trace Node, or the Debugger for a reason.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
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 » SUBSTRING
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.