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 » Comparing fields problem

Post new topic  Reply to topic
 Comparing fields problem « View previous topic :: View next topic » 
Author Message
LH33
PostPosted: Sun Mar 16, 2003 7:28 am    Post subject: Comparing fields problem Reply with quote

Master

Joined: 21 Nov 2002
Posts: 200

HI! I have a message flow that has to evaluate two tags. If the first tag has a "Y" in it then I need to evluate the second tag for not NULL and Greater than zero. My code does not work if the second tag has alphanumerics or spaces in it. I have tried casting to integer and this does not seem to work. Can someone look at the following code and see how I may be able to do this? Thanks!! LisaB

DECLARE TmpPremise INTEGER;
set TmpPremise = CAST
(InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[12] AS INTEGER);


If (InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[13] = 'Y') and
((TmpPremise > 0) and
(TmpPremise IS NOT NULL))
then
SET OutputRoot.XML.CreateJob = NULL;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender.Component;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender.Confirmation;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender.AuthorizationId;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.CreationDateTime;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.BODId;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea.REQ_TYPE;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea.REQ_CODE;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea.PREMISE_NO;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea.RECORD_DATA;
CREATE FIELD OutputRoot.XML.ATLAS_XY_QUERY.DataArea.RECORD_DATA.EXTERNAL_ONE;


SET OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender.Component = 'MDS XY Query';
SET OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.Sender.AuthorizationId =
'ODL Create Job';
SET OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.CreationDateTime = CURRENT_TIMESTAMP;
SET OutputRoot.XML.ATLAS_XY_QUERY.ApplicationArea.BODId = UUIDASBLOB;
SET OutputRoot.XML.ATLAS_XY_QUERY.DataArea.REQ_TYPE = 'PREMISE';
SET OutputRoot.XML.ATLAS_XY_QUERY.DataArea.REQ_CODE = 'COORDINATES';
SET OutputRoot.XML.ATLAS_XY_QUERY.DataArea.PREMISE_NO =
InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.UDF[13];
SET OutputRoot.XML.ATLAS_XY_QUERY.DataArea.RECORD_DATA.EXTERNAL_ONE =
InputRoot.XML.CreateJob.ApplicationArea.BODId;
ELSE return false;
End if;
Back to top
View user's profile Send private message
kirani
PostPosted: Sun Mar 16, 2003 10:53 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

I don't think this will work. If your second element contains CHAR data, it will throw and exception when you try to cast it to an INT.

Folowing code will not work if the incoming element contains any char data (A - Z). Can you control the input data so that it doesn't contain A-Z chars?

Code:

-- If the tag does not exist or contains null value
If (InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[12] = '' OR         
    InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[12] is NULL ) THEN
    SET TempPremise = 0;
ELSE
   -- If the tag is not null and contains SPACE char
   IF (SUBSTRING(InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[12] FROM 1 FOR 1) = ' ') THEN
      SET TeMPPremise = 0;
   ELSE
      SET TeMPPremise = CAST(InputRoot.XML.CreateJob.DataArea.Job.WorkCodeUDFS.WorkCodeUDF[12] AS INT);
   END IF;
END IF;

_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Comparing fields problem
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.