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 » Remove fields with value null from a tree

Post new topic  Reply to topic
 Remove fields with value null from a tree « View previous topic :: View next topic » 
Author Message
jkh
PostPosted: Wed Oct 09, 2013 7:09 am    Post subject: Remove fields with value null from a tree Reply with quote

Newbie

Joined: 09 Oct 2013
Posts: 5

Hi,

I have a challenge with a cobol message that should be mapped to XML.
Empty fields in the cobol message are translated to NULL value in the message tree by the CWF parser. I do not want to have these NULL fields in my xml message. How can I remove all fields in the cobol tree with value NULL?
Is there a simple SELECT statement or should I make a procedure going throw each field and investigate if the fiedvalue is NULL or?

Thanks
Jakob
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Wed Oct 09, 2013 7:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Whats the point of removing these fields ? Why do you as the developer care if an LMT element is null ? What impact does a Null element have on your logic ?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
jkh
PostPosted: Wed Oct 09, 2013 10:08 pm    Post subject: Reply with quote

Newbie

Joined: 09 Oct 2013
Posts: 5

The receiver has created a WSDL (and used it for years) where all elements should be longer than 1 and null has length 0. That is why all null elements should be removed....
Back to top
View user's profile Send private message
dogorsy
PostPosted: Wed Oct 09, 2013 10:32 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

You don't need to do anything. If you use ESQL for the mapping, assigning a NULL to an element in a XMLNSC tree results in that element being deleted.

Your challenge is not in the input data. You get some input, perform a transformation and get the output. All you need to think about is the transformation from input to output, NOT how to modify the input tree. What I said above about XMLNC is ONE way of doing it, there are many more. It is up to you to work out which one works best for you.
Back to top
View user's profile Send private message
jkh
PostPosted: Wed Oct 09, 2013 11:53 pm    Post subject: Reply with quote

Newbie

Joined: 09 Oct 2013
Posts: 5

Thanks for the feed back! I am using a mapping node and not ESQL. I have made the mapping and now I either for each field in the mapping node put in a test for null before the mapping or make a smart routine that remove all nulls...
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Oct 10, 2013 2:22 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
If you use ESQL for the mapping, assigning a NULL to an element in a XMLNSC tree results in that element being deleted.
Sometimes. But there are two types of null in ESQL.
1. Delete the field:
SET OutputRoot.XMLNSC.root.record1.field1 = NULL;

2. Set the value of the field to null
SET OutputRoot.XMLNSC.root.record1.field1 VALUE = NULL;

I think the OP is talking about the latter. In which case, there may be some logic required.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Oct 10, 2013 2:27 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Is there a simple SELECT statement or should I make a procedure going throw each field and investigate if the fiedvalue is NULL or?
It could be done using a JavaCompute node that
- uses XPath to obtain an array of all elements in OutputRoot that have empty string as their value
- walks the array and deletes every such element

Probably could be done using ESQL SELECT. I'm not sufficiently expert to know how.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Oct 10, 2013 5:50 am    Post subject: Reply with quote

Grand High Poobah

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

kimbert wrote:
Probably could be done using ESQL SELECT. I'm not sufficiently expert to know how.




Not sufficiently expert? What hell is this? Who are you, and what have you done with the real kimbert?


_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Remove fields with value null from a tree
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.