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 » Incorrect numeric parsing and conversion

Post new topic  Reply to topic
 Incorrect numeric parsing and conversion « View previous topic :: View next topic » 
Author Message
lozaza
PostPosted: Mon Oct 13, 2014 4:09 pm    Post subject: Incorrect numeric parsing and conversion Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 27

It is my very first message flow, so please be bearable if it sounds gibblish:) I am converting some data from XML to COBOL , all workig fine but the numbers.

below is part of my Copybook:

Code:
 05 NUMBER-OF-ITEMS   PIC 9(4) BINARY.
            05 ITEM OCCURS 1 TO 100 DEPENDING ON NUMBER-OF-ITEMS.
          10 PRODUCT-ID      PIC X(9).
             10 QUANTITY        PIC 9(4) BINARY.
             10 UNIT-COST       PIC 9(8)V99 COMP-3.

and ESQL code:
Code:

      DECLARE I INTEGER 1;
      DECLARE J INTEGER;
      DECLARE A DECIMAL;
      DECLARE B INTEGER;
      SET J = CARDINALITY(InputRoot.XMLNSC.p:Order.p:Order_Items.p:Item[]);
      SET OutputRoot.DFDL.ORDERS.NUMBER_OF_ITEMS = J ;
      WHILE I <= J DO
         SET OutputRoot.DFDL.ORDERS.ITEM[I].PRODUCT_ID = InputRoot.XMLNSC.p:Order.p:Order_Items.p:Item[I].p:Part_Number;
         SET OutputRoot.DFDL.ORDERS.ITEM[I].QUANTITY = InputRoot.XMLNSC.p:Order.p:Order_Items.p:Item[I].p:Quantity;
         SET A = CAST (InputRoot.XMLNSC.p:Order.p:Order_Items.p:Item[I].p:Price AS DECIMAL );
         SET B = CAST (InputRoot.XMLNSC.p:Order.p:Order_Items.p:Item[I].p:Quantity AS INTEGER );
         SET OutputRoot.DFDL.ORDERS.ITEM[I].UNIT_COST = A / B ;
         SET I = I + 1;
      END WHILE;

So basically for the XML, there are 3 items and one of the items for example as below:

Code:
  <p:Part_Number>20000002</p:Part_Number>
  <p:Quantity>4</p:Quantity>
  <p:Description>Railway Track</p:Description>
  <p:Price>10000.00</p:Price>


This is what I can from RFHUtil:

Code:
10    99     2 INT     1 QUANTITY                       0400
***** RFHUtil format error - Invalid Packed Decimal data in next field
10   101     6 PD      1 UNIT-COST                      0F0050020000
05   107    17         2 ITEM
10   107     9 CHAR    2 PRODUCT-ID                     20000003
10   116     2 INT     2 QUANTITY                       0100


the number is not BigEndian and the packed decimal incorrect. As I can understand I don't need to do any conversion in ESQ for the numeric because
they will be parsed automatically. I imported the message model for Copybook as

Target z/os IBM500 for encoing and floating 390. I also defined CCSID 500 and encoding 785 in my esql. Anything wrong or any advice?

JS
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Oct 14, 2014 3:15 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

DFDL may be taking its numeric 'encoding' ( endianness ) from InputRoot.Properties. Look at the numeric field in the DFDL editor - if it is set to $dfd:encoding then my guess is correct.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
lozaza
PostPosted: Tue Oct 14, 2014 6:16 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 27

Hi Kimbert thanks for your reply,

if the DFDL editor is the properties part in right of the tools kit when I select the cobol schema definition, they are all IBM500 for 'Encoding' and bigEndian for 'Byte Order'. I can see {$dfdl:encoding} at the very top but. Normal number is ok for example PIC 9(4), but when Binary and PD involved it shows error.

btw it is Integration bus 9
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Oct 15, 2014 5:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

When dealing with MQ as a transport, you need to consider three things to help resolve conversion questions/problems.

1) Are you using the right thing to view the actual contents of the actual message - i.e. you need to eliminate the tool you're using to view the data as the *cause* of the problem.

2) Is the message moving over an MQ channel that has conversion set?

3) Does the CCSID and Encoding accurately represent the *data* in the message. Not what you think it should be, but what it actually IS.
Back to top
View user's profile Send private message
lozaza
PostPosted: Sun Oct 26, 2014 9:16 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Mar 2013
Posts: 27

Hello MqJeff and Kimbert. Thanks very much for your help! and problem resolved. I am using wrong option in rfhutil to view the message. So DAMN easy. everything is right with message model and my esql.

good learning experience thou
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 » Incorrect numeric parsing and conversion
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.