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 » dropped decimal place on wbimb 5 - CAST as DECIMAL

Post new topic  Reply to topic
 dropped decimal place on wbimb 5 - CAST as DECIMAL « View previous topic :: View next topic » 
Author Message
hornbeam123
PostPosted: Fri Feb 24, 2006 4:40 am    Post subject: dropped decimal place on wbimb 5 - CAST as DECIMAL Reply with quote

Centurion

Joined: 01 Nov 2003
Posts: 101

Problem. Testing of flows under wbimb 5 broker has shown that one subflow is failing i.e. one decimal place (data is sterling amount) is being dropped off.

CAST as DECIMAL used , data o/p is xml and described in mrm as <Price> xsd:decimal

Any help would be much appreciated.

See following for more details.

RESULTS
2.1 csd7 output
<Price>0.10</Price>

5.0 csd6 output
<Price>0.1</Price>

ESQL extract
IF CAST(wasprcInstance.WWW_PRC AS DECIMAL) > 0 THEN
SET "OutputRoot"."MRM"."CascadePrices"."CascadePrice"[itemPointer]."StoreGroupCode" = ConvertBranchPriceCode(wasprcInstance.BRANCH_PRICE_GROUP);

SET "OutputRoot"."MRM"."CascadePrices"."CascadePrice"[itemPointer]."EffectiveDate" = Manual_DATETIMEFormat_TO_YYYYMMDD_BugFix( itemPointer, wasprcInstance.EFFECTIVEDATE );

SET "OutputRoot"."MRM"."CascadePrices"."CascadePrice"[itemPointer]."Level" = '3';

SET "OutputRoot"."MRM"."CascadePrices"."CascadePrice"[itemPointer]."Price" = fix_2decpl(wasprcInstance.WWW_PRC);

IF wasprcInstance.BAR_CD IS NOT NULL THEN ............................



fix_2decpl
CREATE FUNCTION fix_2decpl(number_in CHAR) RETURNS CHAR
BEGIN
DECLARE retval CHAR;
DECLARE before_point CHAR;
DECLARE after_point CHAR;
DECLARE pos_point INTEGER;
DECLARE adjustment_made BOOLEAN;

SET adjustment_made = FALSE;

SET pos_point = POSITION('.' IN number_in);

-- e.g. if input does not have a decimal point
IF (pos_point = 0) THEN
SET before_point = number_in;
SET after_point = '00';
SET retval = before_point || '.' || after_point;
SET adjustment_made = TRUE;
END IF;

-- decimal point is last character in the string
IF ((pos_point = LENGTH(number_in) AND adjustment_made = FALSE)) THEN
IF (number_in = '.') THEN
SET before_point = '00';
SET after_point = '00';
ELSE -- e.g. '12.'
BEGIN
SET before_point = SUBSTRING(number_in FROM 1 FOR LENGTH(number_in)-1);
SET after_point = '00';
END;
END IF;
SET adjustment_made = TRUE;
SET retval = before_point || '.' || after_point;
END IF;

-- Only one digit after decimal point ?
IF (((LENGTH(number_in) - pos_point) = 1) AND adjustment_made = FALSE) THEN
SET number_in = number_in || '0';
SET adjustment_made = TRUE;
SET retval = number_in;
END IF;

IF (adjustment_made = FALSE) THEN
SET retval = number_in;
END IF;

RETURN retval;
END;
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 » dropped decimal place on wbimb 5 - CAST as DECIMAL
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.