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 » Compiler change from v5 to v6 broker for references?

Post new topic  Reply to topic
 Compiler change from v5 to v6 broker for references? « View previous topic :: View next topic » 
Author Message
klabran
PostPosted: Thu Oct 19, 2006 2:37 pm    Post subject: Compiler change from v5 to v6 broker for references? Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

It seems that the v6 broker compilation works differently with references than the v5 broker....

Below is my code snippet:

Code:

DECLARE refBookID REFERENCE TO Body.cjs_Report.Booking.Suspect.BookingAgencyRecordID."j:ID";
--Check if this is a booking.  Do not want arrests checked.
IF refBookID IS NOT NULL AND TRIM(' ' FROM refBookID) <> 'CNO0' THEN


My incoming data is XML.

In v5 of the broker if "j:ID" was filled in then refBookID was the value of "j:ID"
In v5 of the broker if "j:ID" is missing then refBookID is NULL.

In v6 of the broker if "j:ID" was filled in then refBookID was the value of "j:ID". This is good....
In v6 of the broker if "j:ID" is missing then refBookID returns the entire body (tree)...???

This change is causing my IF clause to fail now....

Is this right or am I missing something???

Thanks,

Kevin
Back to top
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Thu Oct 19, 2006 7:36 pm    Post subject: Reply with quote

Grand High Poobah

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

This is right .
What you are missing is
Code:
IF LASTMOVE(reference) THEN
     -- the move was successful the reference is valid
ELSE
     /* the move was not successful and the reference probably still contains the previous value. */
END IF;


Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
klabran
PostPosted: Fri Oct 20, 2006 6:12 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

Thanks fjb_saper!

Changed the IF to

Code:

IF LASTMOVE(refBookID) AND TRIM(' ' FROM refBookID) <> 'CNO0' THEN


All is well again!
Back to top
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Fri Oct 20, 2006 7:11 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You can also check if FIELDNAME(reference) is NULL.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Yaroslav
PostPosted: Fri Oct 20, 2006 10:38 am    Post subject: Reply with quote

Novice

Joined: 28 Sep 2006
Posts: 12
Location: Russia

jefflowrey wrote:
You can also check if FIELDNAME(reference) is NULL.

Hi, jefflowrey!
I am sorry , but your advice may be used only for static reference, not for dynamic.
_________________
IBM Certified Solution Designer WebSphere MQ V6.0
IBM Certified Solution Developer WebSphere Message Broker V6.0
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 20, 2006 10:47 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yaroslav - I guess I don't understand what you mean.

A variable of REFERENCE type only ever points to one thing at a time.

FIELDNAME is documented to return NULL if it's given a NULL input.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 20, 2006 3:26 pm    Post subject: Reply with quote

Grand High Poobah

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

jefflowrey wrote:
Yaroslav - I guess I don't understand what you mean.

A variable of REFERENCE type only ever points to one thing at a time.

FIELDNAME is documented to return NULL if it's given a NULL input.

I believe the point here is that he is not setting any value to the field but just walking the input tree.
Now if the field he is trying to walk to does not exist on the tree the value of the reference is not null but some tree structure... The value of LASTMOVE(reference) however is FALSE.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Fri Oct 20, 2006 6:00 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Well, I think if I do a MOVE off the end of the tree, then the reference will still be NULL as far as FIELDVALUE is concerned.

But, on the other hand, I haven't actually tested it, so I'm probably wrong.

On the third hand, any time you do a MOVE you should absolutely do a LASTMOVE.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
klabran
PostPosted: Sat Oct 21, 2006 11:38 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 259
Location: Flagstaff AZ

They both work properly.

Code:

IF FIELDNAME(refBookID) IS NOT NULL AND TRIM(' ' FROM refBookID) <> 'CNO0' THEN   


Code:

IF LASTMOVE(refBookID) AND TRIM(' ' FROM refBookID) <> 'CNO0' THEN


I am not moving at all in this scenario except of course when the reference is being created in the variable declaration statement. I was simply setting a reference for ease of coding (much easier to type refBookID instead of body.blah.blah.blah.blah .
Back to top
View user's profile Send private message Visit poster's website
mgk
PostPosted: Sun Oct 22, 2006 8:54 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Hi,

You should really do a LASTMOVE after the DECLARE of a REFERENCE if you cannot be sure that the place you are telling the reference point to exists.

A REFERENCE that is DECLAREd to point to somewhere that does not exist is made to point to the root of the tree you were trying to make it point within, and a LASTMOVE after the DECLARE will return FALSE.
_________________
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
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 » Compiler change from v5 to v6 broker for references?
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.