|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to identify a variable with only spaces |
« View previous topic :: View next topic » |
Author |
Message
|
ktg |
Posted: Fri May 13, 2011 4:43 am Post subject: How to identify a variable with only spaces |
|
|
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 |
|
 |
j.f.sorge |
Posted: Fri May 13, 2011 4:57 am Post subject: |
|
|
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 |
|
 |
mqjeff |
Posted: Fri May 13, 2011 5:14 am Post subject: |
|
|
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 |
|
 |
ktg |
Posted: Sun May 15, 2011 9:05 pm Post subject: |
|
|
Centurion
Joined: 09 Jan 2006 Posts: 138 Location: India
|
Thanks for the inputs.
Regards,
Kalpana |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|