Author |
Message
|
manoj5007 |
Posted: Wed Oct 16, 2013 6:26 am Post subject: Checking whether CorrelId is set to all Zeros |
|
|
 Acolyte
Joined: 15 May 2013 Posts: 64
|
Hi. My requirement is to check whether the correlId is set to all zeros. Based on a valid correlId, the message is to be propogated to one terminal and if its all zeros than the message has to be propogated to another node. Could you please help me with the above scenario. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 16, 2013 6:27 am Post subject: Re: Checking whether CorrelId is set to all Zeros |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
manoj5007 wrote: |
My requirement is to check whether the correlId is set to all zeros. |
My first thought is to use an IF statement. I imagine that was your first thought as well, so perhaps you could expand a little on where you need help....? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
zpat |
Posted: Wed Oct 16, 2013 7:06 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Filter node _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 16, 2013 7:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Which has an IF in it. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 16, 2013 8:14 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
What's the confusion?
You want to determine if the correlID is all zeros, and then take an action based on the result of that.
The way you do that is to write your flow.
There are lots of different ways to do this in WMB.
All of them require that you actually take steps to develop the flow.
So go, take steps, and develop the flow.
Using your knowledge and experience and training and the documentation. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 16, 2013 11:02 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And check out the meaning and value of the MQCI_XXXX constants. Here XXXX stands for some value...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
manoj5007 |
Posted: Wed Oct 16, 2013 10:08 pm Post subject: |
|
|
 Acolyte
Joined: 15 May 2013 Posts: 64
|
I can't use a IF statement for BLOB i.e.
IF InputRoot.MQMD.CorrelId = 00000000000000000000000000000
THEN PROPAGATE TO TERMINAL out
ELSE
PROPAGATE TO TERMINAL out1
The above statement will result in error.
I am not sure how to check the value of BLOB type and the MQCI constant for correlid with all zeors is MQCI_NONE. |
|
Back to top |
|
 |
Simbu |
Posted: Wed Oct 16, 2013 10:43 pm Post subject: |
|
|
 Master
Joined: 17 Jun 2011 Posts: 289 Location: Tamil Nadu, India
|
manoj5007 wrote: |
I can't use a IF statement for BLOB i.e.
IF InputRoot.MQMD.CorrelId = 00000000000000000000000000000
THEN PROPAGATE TO TERMINAL out
ELSE
PROPAGATE TO TERMINAL out1
The above statement will result in error.
I am not sure how to check the value of BLOB type and the MQCI constant for correlid with all zeors is MQCI_NONE. |
Quote: |
The BLOB data type holds a variable length string of 8-bit bytes. It is commonly used to represent arbitrary binary data. A BLOB literal consists of the letter X, followed by a string of hexadecimal digits enclosed in single quotation marks, as in the following example:
X'0123456789ABCDEF'
There must be an even number of digits in the string, because two digits are required to define each byte. Each digit can be one of the hexadecimal digits 0-9 and A-F. Both the initial X and the hexadecimal letters can be specified in uppercase or lowercase. |
|
|
Back to top |
|
 |
dogorsy |
Posted: Wed Oct 16, 2013 11:13 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
manoj5007 wrote: |
I can't use a IF statement for BLOB i.e.
IF InputRoot.MQMD.CorrelId = 00000000000000000000000000000
THEN PROPAGATE TO TERMINAL out
ELSE
PROPAGATE TO TERMINAL out1
The above statement will result in error.
I am not sure how to check the value of BLOB type and the MQCI constant for correlid with all zeors is MQCI_NONE. |
Yes, that will give an error. Have you read the error message ?, even more, not only read it, try to understand what the message is telling you. Then you can see how to fix your code.
Of course, you need to understand the ESQL data types, so it would be a good idea if you start with that |
|
Back to top |
|
 |
manoj5007 |
Posted: Mon Oct 21, 2013 4:46 am Post subject: |
|
|
 Acolyte
Joined: 15 May 2013 Posts: 64
|
Resolved it by declaring a BLOB variable as shown below:
DECLARE temp BLOB ;
SET temp='00000000000000000000' with even number of digits equal to the number of zeros we will be getting when correl Id is set to MQCI_NONE. Then I compare the CorrelId with temp variable.
This does sound little dirty but then I couldn't find a better way.
Its works only with the quotes. Could anyone explain why so?? |
|
Back to top |
|
 |
mgk |
Posted: Mon Oct 21, 2013 5:02 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
So did you try just using the constant like this:
Code: |
IF InputRoot.MQMD.CorrelId = MQCI_NONE THEN
...
END IF; |
Kind regards, _________________ 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 |
|
 |
dogorsy |
Posted: Mon Oct 21, 2013 5:53 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
manoj5007 wrote: |
Its works only with the quotes. Could anyone explain why so?? |
As I said before, you need to learn about ESQL data types. Then you will know why you need to enclose it in quotes. |
|
Back to top |
|
 |
reddy2078 |
Posted: Mon Oct 21, 2013 6:01 am Post subject: |
|
|
Newbie
Joined: 21 Apr 2013 Posts: 7
|
manoj5007 wrote: |
Resolved it by declaring a BLOB variable as shown below:
DECLARE temp BLOB ;
SET temp='00000000000000000000' with even number of digits equal to the number of zeros we will be getting when correl Id is set to MQCI_NONE. Then I compare the CorrelId with temp variable.
This does sound little dirty but then I couldn't find a better way.
Its works only with the quotes. Could anyone explain why so?? |
Manoj why dont u try this
Code: |
DECLARE CORREL_ID CHARACTER CAST (InputRoot.MQMD.CorrelId AS CHAR); |
Output of Debug:
CORREL_ID:CHARACTER:X'000000000000000000000000000000000000000000000000'
Code: |
DECLARE N1 INTEGER LENGTH(CORREL_ID); |
Output of Debug:
N1:INTEGER:51
Code: |
DECLARE CORREL_ID_FINL CHARACTER SUBSTRING ( CORREL_ID FROM 3 FOR N1-3) ;
|
Output of Debug:
CORREL_ID_FINL:CHARACTER:000000000000000000000000000000000000000000000000 |
|
Back to top |
|
 |
gbaddeley |
Posted: Mon Oct 21, 2013 2:50 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
FWIW, MQCI_NONE is 24 null characters, not 24 numeric 0 characters. _________________ Glenn |
|
Back to top |
|
 |
manoj5007 |
Posted: Tue Oct 22, 2013 1:09 am Post subject: |
|
|
 Acolyte
Joined: 15 May 2013 Posts: 64
|
@mgk
Thanks a lot mgk. It worked. When I had tried it before, I tried with quotes , my bad i.e. IF InputRoot.MQMD.CorrelId = 'MQCI_NONE' THEN
END IF. .
IF InputRoot.MQMD.CorrelId = MQCI_NONE THEN
ENDIF is working perfectly fine.
Thank you all for the tips. |
|
Back to top |
|
 |
|