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 IndexWebSphere Message Broker SupportCAST Function

Post new topicReply to topic
CAST Function View previous topic :: View next topic
Author Message
saulgoodman
PostPosted: Mon May 15, 2017 5:10 am Post subject: CAST Function Reply with quote

Newbie

Joined: 15 May 2017
Posts: 3

Hello Folks,

I want to check in a string whether it contains all numbers or some characters.
I was thinking of using CAST function. By this, I wanted to cast the string to integer and see if we get success.
But I am stuck at handling the condition!
What can I do to check if the string is successfully cast?
Can flagging help here? What is the default return of CAST function?

Thanks in advance.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 5:17 am Post subject: Re: CAST Function Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24262
Location: Ohio, USA

saulgoodman wrote:
What is the default return of CAST function?


Erm....whatever you set it to be in the DEFAULT option?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 5:23 am Post subject: Re: CAST Function Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24262
Location: Ohio, USA

saulgoodman wrote:
I was thinking of using CAST function.


I'd be more inclined to use TRANSLATE.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
saulgoodman
PostPosted: Mon May 15, 2017 5:46 am Post subject: Re: CAST Function Reply with quote

Newbie

Joined: 15 May 2017
Posts: 3

Vitor wrote:
saulgoodman wrote:
I was thinking of using CAST function.


I'd be more inclined to use TRANSLATE.


Ok, can you please give example, how TRANSLATE can be used in my case?
Your help is appreciated.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 5:55 am Post subject: Re: CAST Function Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24262
Location: Ohio, USA

saulgoodman wrote:
Ok, can you please give example, how TRANSLATE can be used in my case?


Check of the LENGTH of the string once you've removed all the numeric characters from the string with TRANSLATE. If the length is 0, it was fully numeric.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
saulgoodman
PostPosted: Mon May 15, 2017 6:31 am Post subject: Re: CAST Function Reply with quote

Newbie

Joined: 15 May 2017
Posts: 3

Vitor wrote:


Check of the LENGTH of the string once you've removed all the numeric characters from the string with TRANSLATE. If the length is 0, it was fully numeric.


Thanks a lot mate!!
IT WORKED!
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 6:33 am Post subject: Re: CAST Function Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24262
Location: Ohio, USA

saulgoodman wrote:

Thanks a lot mate!!
IT WORKED!


Despite appearances to the contrary, I do (sometimes) know what I'm talking about.

Glad you have an acceptable solution.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportCAST Function
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.