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 » Database Lookup not working

Post new topic  Reply to topic
 Database Lookup not working « View previous topic :: View next topic » 
Author Message
LH33
PostPosted: Wed Mar 12, 2003 2:08 pm    Post subject: Database Lookup not working Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

HI! I have to take a value and look up it's decode value in a table. If no value is sent down in the XML, I need to assign a value of "DEFAULT" to the OutputRoot tag. It works fine if a valid value is sent down, but when no data is in the input tag, it doesn't assign the "DEFAULT". Can someone help me and see where I am messing up?

Thank you so much!! Lisa

Here is my code:

SET OutputRoot = InputRoot;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
DECLARE SqlState1 Character;
DECLARE SqlErrorText1 Character;
DECLARE SqlCode1 integer;
DECLARE SqlNativeError1 integer;
DECLARE IntSqlState integer;

Set OutputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode =
THE (SELECT ITEM A.CITY_ABBR FROM Database.BGE_LKUP_CITY as A where A.CITY_BGE =
InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode);

SET SqlState1 = sqlstate;
SET SqlCode1 = sqlcode;
SET SqlErrorText1 = sqlerrortext;
SET SqlNativeError1 = sqlnativeerror;
SET IntSqlState = CAST (SqlState AS INTEGER);
IF (IntSqlState <> 0)
or (InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode IS NULL)
or (InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode = ' ')
then
set OutputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode = 'UNKNOWN';
END IF;
Back to top
View user's profile Send private message
AlexeiSkate
PostPosted: Wed Mar 12, 2003 2:29 pm    Post subject: Reply with quote

Centurion

Joined: 10 Apr 2002
Posts: 123

Have you try using a trace node to see if the SELECT returned anything?

I'm not sure if this makes any difference, but I think your conditional statement has to be something like

...or (InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode.CITY_ABBR IS NULL) or
(InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode.CITY_ABBR = ' ')
...
Back to top
View user's profile Send private message
LH33
PostPosted: Wed Mar 12, 2003 2:31 pm    Post subject: Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

I haven't tried the trace node yet. What would I code in the trace node to see if the select returned anything?

Thank you!!
Back to top
View user's profile Send private message
lung
PostPosted: Wed Mar 12, 2003 5:36 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

This is what we did in our flows... In your trace, put $LocalEnvironment, this will display the LocalEnvironment values in your trace.

Then add this code.
Code:
Set OutputLocalEnvironment.Variables.XML.CityCode =
THE (SELECT ITEM A.CITY_ABBR FROM Database.BGE_LKUP_CITY as A where A.CITY_BGE =
InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode);


Now look into your trace file.

Anyway, I think the code for your IF statements should refer to OutputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode.CITY_ABBR instead of InputRoot.XML.CreateJob.DataArea.Job.Location.Address.CityCode? Not sure what you want, actually.
_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
lillo
PostPosted: Wed Mar 12, 2003 11:26 pm    Post subject: Reply with quote

Master

Joined: 11 Sep 2001
Posts: 224

Lung,

You forgot the brakets. In the trace node you should have
Code:
${LocalEnvironment}


Cheers,
_________________
Lillo
IBM Certified Specialist - WebSphere MQ
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Mar 13, 2003 7:22 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

I would also copy your SQL returns to the LocalEnvironment as well.

You 'might' be getting a 0 back for SqlState

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
lung
PostPosted: Thu Mar 13, 2003 4:17 pm    Post subject: Reply with quote

Master

Joined: 27 Aug 2002
Posts: 291
Location: Malaysia

Thanks for the correction there, lillo
Can't believe I made such a mistake...
_________________
lung
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Database Lookup not working
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.