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 » field with nothing in question

Post new topic  Reply to topic
 field with nothing in question « View previous topic :: View next topic » 
Author Message
pcelari
PostPosted: Thu Mar 15, 2007 5:44 am    Post subject: field with nothing in question Reply with quote

Chevalier

Joined: 31 Mar 2006
Posts: 411
Location: New York

a field in my tree could be empty,

<myDataTree>
<itemCode/>
<itemName>iPod<itemName>
<myDataTree>

in such case, I need to populate a variable with default value '999'.

I tried the following:
declare c char InputBody.myDataTree.itemCode;

if c = NULL then
set c = '999';
end if;

Nor does it work with

if length(c) = 0 then
set c = '999';
end if;

nor
if c = '' then
set c = '999';
end if;

So, what should I use to accomplish this? What is c in such case? It must be sth trivial, what am I missing?

thanks for any insight!
_________________
pcelari
-----------------------------------------
- a master of always being a newbie
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Mar 15, 2007 5:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

I would try something like:

Code:

IF InputBody.myDataTree.itemCode IS NULL THEN
  SET c = '999';
END IF;


Code from memory, untested, use at your own risk, etc, etc...
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
special_agent_Queue
PostPosted: Thu Mar 15, 2007 5:57 am    Post subject: Reply with quote

Centurion

Joined: 27 Jul 2006
Posts: 102

What domain are you using?

In XMLNSC, I've found that checking the FIELDTYPE of an element is more reliable than checking it for null, etc.
Back to top
View user's profile Send private message
pcelari
PostPosted: Thu Mar 15, 2007 6:22 am    Post subject: Reply with quote

Chevalier

Joined: 31 Mar 2006
Posts: 411
Location: New York

thanks a lot for the insight, it works. But I prefer to test the content of c after the assignment.

I use MRM.

in my case what is the content of c after the statement below?

set c = InputBody.myDataTree.itemCode;

thanks,
_________________
pcelari
-----------------------------------------
- a master of always being a newbie
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Mar 15, 2007 6:28 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

What does the Trace node say?
Back to top
View user's profile Send private message
broker_new
PostPosted: Sat Mar 24, 2007 10:06 am    Post subject: Reply with quote

Yatiri

Joined: 30 Nov 2006
Posts: 614
Location: Washington DC

As you are using InputBody there is no need of using the myDataTree you can code directly as InputBody.itemCode here.

IF InputBody.itemCode IS NULL THEN
SET c = '999';
END IF;
_________________
IBM ->Let's build a smarter planet
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Sat Mar 24, 2007 1:23 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi pcelari,
pcelari wrote:
thanks a lot for the insight, it works. But I prefer to test the content of c after the assignment.

I use MRM.

in my case what is the content of c after the statement below?

set c = InputBody.myDataTree.itemCode;

thanks,
Maybe you should use
Code:
if c IS NULL then

Regards.
Back to top
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Mar 25, 2007 5:14 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

And you did not try anything like
IF c VALUE IS NULL ???

IF c is null -- wouldn't that mean that c did not exist on the part that the assignment did?

You could as well try a ref.. check that the assignment is correct by using Lastmove(ref) and then copy the assignment to c.

Then you should be able to test the VALUE of your ref.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
maanav_kr
PostPosted: Tue Mar 27, 2007 6:38 pm    Post subject: Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

am trying to achieve something very close to current issue. I have to validate messages which may have blank tags.. or tags may be missing. Domain is XMLNSC. Their are few tags which could be a field and there are few of type folder

I am creating reference to the tag

Code:
DECLARE ABCRef REFERENCE to InputRoot.XMLNSC.NS1:abc;

declare ft_anc integer   FIELDTYPE(ABCRef);


but am not getting dependable output.

Code:
      IF NOT (LastMove(ABCRef)) THEN
         set Environment.abc_NULL= 'TRUE';
      ELSEIF FIELDTYPE(ABCRef) IS NULL THEN      
         set Environment.abc_NULL= 'TRUE';
      ELSEIF ft_abc = XMLNSC.Field THEN   
         set Environment.abc_NULL= 'TRUE';
     ELSEIF ft_abc = XMLNSC.Folder THEN   
         set Environment.abc_NULL= 'TRUE';      
      else
         set Environment.abc_NULL= 'FALSE';
      end if;   
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » field with nothing in question
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.