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 » FIELDTYPE Issue ... Checking for existence of input field

Post new topic  Reply to topic
 FIELDTYPE Issue ... Checking for existence of input field « View previous topic :: View next topic » 
Author Message
cadenza
PostPosted: Tue Dec 12, 2006 8:55 am    Post subject: FIELDTYPE Issue ... Checking for existence of input field Reply with quote

Apprentice

Joined: 01 Jun 2004
Posts: 48

Hi All,

As per the manual FIELDTYPE function is recommended to test the presence of an input field.

I have a large nested XML message that has a combination of lot of repeating segments. Therefore I have used references to access these elements.

Code:

IF FIELDTYPE(REF_Segment1) IS NOT NULL THEN

Process Data 1

END IF

IF FIELDTYPE(REF_Segment2) IS NOT NULL THEN

Process Data 2

END IF


However it is not working as expected. If there is no Segment2 in the input message it is entering Process Data 2.

I changed FIELDTYPE to FIELDNAME and found in the trace that the name returned for Segment2 is the parent field !!!!

For eg:

For the following abstract of input message
<Library> <Book> <Fiction> <SciFi> ....

if my REF_Segment2 points to Library.Book.Fiction.SciFi and if it is absent then FIELDNAME(REF_Segment2) is returning me "Fiction" !!!

I am not sure if I have understood the FIELDNAME function correctly. I guess it is the same reason why FIELDTYPE is also not returning NULL to me. May be it is returning the field type of Fiction instead of SciFi.

In this scenario ... can any one of you tell me how to test for the presence of input field correctly? I have searched this forum and it seems that if we do not use REFERENCES then it may work ... however that solution wont work for me as I need to use REFERENCES.

I am using MB 5.0 CSD 5

Thanx.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Tue Dec 12, 2006 9:22 am    Post subject: Re: FIELDTYPE Issue ... Checking for existence of input fiel Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi cadenza,

FIELDNAME is supposed to return the name of the field, if it is returning Fiction, then the reference is pointing at that, how it reached there will only be understood if we see ur code....If Library did not exist and you had DECLAREed your reference directly to it, it would have pointed on Root.

FIELDTYPE is supposed to return the type such as integer, string etc...

If you want to check existance of the field, you could use DECLARE or MOVE(since ur using a reference) and then check for LASTMOVE....

Regards.
Back to top
View user's profile Send private message Send e-mail
special_agent_Queue
PostPosted: Tue Dec 12, 2006 9:58 am    Post subject: Reply with quote

Centurion

Joined: 27 Jul 2006
Posts: 102

This indicates to me that you are not referencing correctly.

Check to make sure your path is correct.

Or use the LASTMOVE as elvis_gn suggested. This is the way I would go- sometimes the FIELDTYPE/FIELDNAME functions can be tricky.
Back to top
View user's profile Send private message
cadenza
PostPosted: Tue Dec 12, 2006 1:10 pm    Post subject: Reply with quote

Apprentice

Joined: 01 Jun 2004
Posts: 48

Hi All,

The references are correct ... I have double checked them. However thanx for your suggestions ... it is working with LASTMOVE.

So for checking the existence of any input field the recommended steps would be ...

Declare Reference to the input field

IF LASTMOVE(Reference) THEN

Field Exists

ELSE

Field Does not exist.

END IF;

But I do wonder what went wrong with FIELDNAME & FIELDTYPE functions.

Any Ideas?

Thanx.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Dec 12, 2006 1:26 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Is CSD05 the most recent CSD of WBIMB v5?
_________________
I am *not* the model of the modern major general.
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 » FIELDTYPE Issue ... Checking for existence of input field
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.