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 » How to identify a variable with only spaces

Post new topic  Reply to topic
 How to identify a variable with only spaces « View previous topic :: View next topic » 
Author Message
ktg
PostPosted: Fri May 13, 2011 4:43 am    Post subject: How to identify a variable with only spaces Reply with quote

Centurion

Joined: 09 Jan 2006
Posts: 138
Location: India

Hi All,

We have a MQ request/response scenario. Reply will be sent to a queue. If the requester has specified MQMD.Reply2Q, then reply should be sent to that particular queue otherwise, reply should be sent to a fixed(constant) queue.

For this logic, we are having below code
Code:

IF LENGTH(TRIM(InputRoot.MQMD.ReplyToQ)) = 0 THEN
   SET OutputRoot.MQMD.ReplyToQ = UDP_REPLY2QUEUE;
ELSE
   SET OutputRoot.MQMD.ReplyToQ = InputRoot.MQMD.ReplyToQ;
END IF;


Is there is any other easy way to check whether InputRoot.MQMD.ReplyToQ is having only spaces?

Thanks,
Kalpana
Back to top
View user's profile Send private message AIM Address
j.f.sorge
PostPosted: Fri May 13, 2011 4:57 am    Post subject: Reply with quote

Master

Joined: 27 Feb 2008
Posts: 218

We are using a default FUNCTION which does quite the same in order to check empty elements.
Code:
RETURN ( COALESCE( LENGTH( TRIM(chValue) ), 0) = 0 );

_________________
IBM Certified Solution Designer - WebSphere MQ V6.0
IBM Certified Solution Developer - WebSphere Message Broker V6.0
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
mqjeff
PostPosted: Fri May 13, 2011 5:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Code:
if InputRoot.MQMD.ReplyToQ LIKE ' %'

Code:
if InputRoot.MQMD.ReplyToQ == SPACE(Length(InputRoot.MQMD.ReplyToQ)

Code:
if Translate(InputRoot.MQMD.ReplyToQ,' ') IS NOT NULL


That last one might not be entirely correct in what it checks against. If you pass in a string that only consists of spaces, I'm not positive that the result will actually be NULL. It should be, but it might just be the empty string ('') instead.

Several other options. Note that the LIKE expression in the first one is '<space>%'.
Back to top
View user's profile Send private message
ktg
PostPosted: Sun May 15, 2011 9:05 pm    Post subject: Reply with quote

Centurion

Joined: 09 Jan 2006
Posts: 138
Location: India

Thanks for the inputs.

Regards,
Kalpana
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to identify a variable with only spaces
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.