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 » Deleting fields where field path is set in a character

Post new topic  Reply to topic
 Deleting fields where field path is set in a character « View previous topic :: View next topic » 
Author Message
amiivas
PostPosted: Fri Dec 18, 2009 1:46 pm    Post subject: Deleting fields where field path is set in a character Reply with quote

Apprentice

Joined: 14 Oct 2007
Posts: 44
Location: Texas, USA

Hi,
I want to delete a field whose position is defined in a character.
For e.g, this is the tree structure: OutputRoot.XMLNSC.Company.Name.FirstName;

I am getting this path stored in a character. say
DECLARE absPath CHARACTER 'OutputRoot.XMLNSC.Company.Name.FirstName';

whenever I am using DELETE or DETACH stmts, like DELETE FIELD abPath;
or DETACH absPath;
It give me a 'Inappropriate field reference'

Thanks,
Back to top
View user's profile Send private message
rekarm01
PostPosted: Sat Dec 19, 2009 2:29 pm    Post subject: Re: Deleting fields where field path is set in a character Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Declare abspath as a REFERENCE, instead of a CHARACTER.
Back to top
View user's profile Send private message
amiivas
PostPosted: Sat Dec 19, 2009 3:17 pm    Post subject: Reply with quote

Apprentice

Joined: 14 Oct 2007
Posts: 44
Location: Texas, USA

In the actual issue, this absPath is build rather than just declared. The building of absPath is done by adding multiple FieldNames during the tree traversal.
_________________
IBM WebSphere Certified Solution Developer
Back to top
View user's profile Send private message
mqjeff
PostPosted: Sat Dec 19, 2009 6:48 pm    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can only use DELETE and DETACH with REFERENCE variables.

It therefore doesn't matter what or how you have built the contents of a CHARACTER variable.

If! absPath contained only the name of a single field, you could use {} as part of a MOVE statement.

If you insist on using a CHARACTER variable and building a multi-level hierarchical name in that CHARACTER variable, you will have to use the non-performant EVALUATE function to construct a MOVE statement to point a REFERENCE variable.

I recommend rethinking your approach, however.
Back to top
View user's profile Send private message
amiivas
PostPosted: Sat Dec 19, 2009 7:51 pm    Post subject: Reply with quote

Apprentice

Joined: 14 Oct 2007
Posts: 44
Location: Texas, USA

Yes, Eval is an expensive statement and that will help but I would not like to use as the function has to be performed on many fields references.
I am actually looking for a way, not to create parent node if value of child node is not present. The thought of passing the output tree to a recursive function in which save the path of that field which does not have a value and delete that field so that parent of that child is also not created, posed the above question of deleting field whose path is stored in character.

Coming back to my original issue, SET creates the tree till the point of last but one field and only create the last field if it has value. This property is actually creating empty tags [parent] in output xml which is not required.

I don't want to use a null check or exist fn for every field as there are around more than 500 fields . Any fast work around solution is appreciated or else I have to go back for manual coding of many IFs.
Thanks - Amit
_________________
IBM WebSphere Certified Solution Developer
Back to top
View user's profile Send private message
kimbert
PostPosted: Sun Dec 20, 2009 2:26 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I don't want to use a null check or exist fn for every field as there are around more than 500 fields . Any fast work around solution is appreciated or else I have to go back for manual coding of many IFs
Maybe you could write a function which takes a source reference and a target reference. It sets the value of the target reference if and only if the source value is not NULL/empty string. No need for 500 IF statements.
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 » Deleting fields where field path is set in a character
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.