Author |
Message
|
ydeonia |
Posted: Tue Aug 13, 2013 1:10 am Post subject: Case sensitive compare of strings ? |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
Hi
I want to compare strings as case sensitive like
POSITION ( 'RT' IN lDesc) <> '0'
even If lDesc = 'TERT' or lDesc = 'terT' , it passes the condition .
Please help me in this so that it allows only of it maches uppercase 'RT'
Thanks |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Aug 13, 2013 1:19 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Have you looked at the CONTAINS function. _________________ 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 |
|
 |
ydeonia |
Posted: Tue Aug 13, 2013 1:24 am Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
smdavies99 wrote: |
Have you looked at the CONTAINS function. |
I tried but its not working because of my WMB version so I have to with POSITION function instead
Any help in position one please |
|
Back to top |
|
 |
dogorsy |
Posted: Tue Aug 13, 2013 1:39 am Post subject: Re: Case sensitive compare of strings ? |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
ydeonia wrote: |
Hi
I want to compare strings as case sensitive like
POSITION ( 'RT' IN lDesc) <> '0'
even If lDesc = 'TERT' or lDesc = 'terT' , it passes the condition .
Please help me in this so that it allows only of it maches uppercase 'RT'
Thanks |
if IDesc is 'TERT' then the function will return 3
for 'terT' should return 0
I doubt it is returning the wrong value. Please run a user trace and post the relevant bit to prove what you are saying. |
|
Back to top |
|
 |
ydeonia |
Posted: Tue Aug 13, 2013 1:43 am Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
@dogorsy so does that mean it will consider the case sensitive values. If yes, no its not. Its still passes. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Aug 13, 2013 1:44 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
What version of broker are you using? _________________ 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 |
|
 |
ydeonia |
Posted: Tue Aug 13, 2013 1:48 am Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
smdavies99 wrote: |
What version of broker are you using? |
Version 6.1.0.3
I read here that its BUG in the toolkit to accept the CONTAINS fuction |
|
Back to top |
|
 |
dogorsy |
Posted: Tue Aug 13, 2013 1:55 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
ydeonia wrote: |
@dogorsy so does that mean it will consider the case sensitive values. If yes, no its not. Its still passes. |
On what basis you assert that it is failing ? Please run a user trace.
Below are the results in my system. so it is very likely that your code is wrong.
Code: |
Evaluating expression ''POSITION('RT' IN IDesc)'' at ('.test_Compute.Main', '5.17'). This resolved to ''POSITION('RT' IN 'TERT')''. The result was ''3'' |
Code: |
Evaluating expression ''POSITION('RT' IN IDesc)'' at ('.test_Compute.Main', '7.17'). This resolved to ''POSITION('RT' IN 'terT')''. The result was ''0'' |
As I said in my previous post, run a user trace. If you don't know how to do that, look in the infocenter, it explains how to do that. |
|
Back to top |
|
 |
ydeonia |
Posted: Tue Aug 13, 2013 2:02 am Post subject: |
|
|
Acolyte
Joined: 29 Oct 2012 Posts: 74
|
dogorsy wrote: |
As I said in my previous post, run a user trace. If you don't know how to do that, look in the infocenter, it explains how to do that. |
Thanks for clarification
here is what I am using the code to validate the presence of string in the value
Code: |
IF Nature IN ('EA','EM') AND POSITION ( 'P720' IN lDesc) <> '0' AND POSITION ( 'RT' IN lDesc)<> '0' THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName ='WMB.9D1.ASUB_PRODUCT'; |
And my lDesc value is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720rT |
And I got the message in the Queue.
IF lDesc is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720 |
I dont get the message which is expected.
When lDesc is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720 RT |
I got the message.
So where I am doing wrong? |
|
Back to top |
|
 |
dogorsy |
Posted: Tue Aug 13, 2013 2:08 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
ydeonia wrote: |
dogorsy wrote: |
As I said in my previous post, run a user trace. If you don't know how to do that, look in the infocenter, it explains how to do that. |
Thanks for clarification
here is what I am using the code to validate the presence of string in the value
Code: |
IF Nature IN ('EA','EM') AND POSITION ( 'P720' IN lDesc) <> '0' AND POSITION ( 'RT' IN lDesc)<> '0' THEN
SET OutputLocalEnvironment.Destination.MQ.DestinationData[1].queueName ='WMB.9D1.ASUB_PRODUCT'; |
And my lDesc value is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720rT |
And I got the message in the Queue.
IF lDesc is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720 |
I dont get the message which is expected.
When lDesc is
Code: |
BR RM EU XTE2 320 B 3.51 PAO P720 RT |
I got the message.
So where I am doing wrong? |
RUN A USER TRACE ... what part of that you don't understand ?!
As far as I can see, there is nothing wrong with POSITION or with ESQL. You have a problem with the LOGIC, and there is nothing people in this forum can do about it. It is up to you to work the logic needed for your business. |
|
Back to top |
|
 |
NealM |
Posted: Thu Aug 15, 2013 12:45 pm Post subject: |
|
|
 Master
Joined: 22 Feb 2011 Posts: 230 Location: NC or Utah (depends)
|
Remove the quotes around both of your 0's. POSITION returns an integer, not a char. |
|
Back to top |
|
 |
|