Copyright © TIBCO Software Inc. All rights reserved
Copyright © TIBCO Software Inc. All rights reserved


Chapter 4 Using the Adapter : Sending and Receiving Numeric Data Types

Sending and Receiving Numeric Data Types
When sending records from FilePublisher with Packed Decimal fields (COMP-3), the message item description must set the type to either COMP-3 or PACKED. The packed data is automatically converted to 8-byte floating point DOUBLE on the wire, unless the convertToString option is used. A convertToString="true" causes the packed data to be converted in to a DISPLAY format, sent as STRING on the wire. This avoids any loss of precision and rounding that can occur if FLOAT is used to represent decimal numbers. Sample definitions are shown below:
Sent as DOUBLE:
messageItem = { position="4", precision="7,2",
                label="ITEM-PRICE", type="COMP-3" },
Sent as STRING:
messageItem = { position="4", precision="7,2",
                label="ITEM-PRICE", type="COMP-3",
                convertToString="true" },
 
When sending records with COMP-1 FLOAT, you might set the type field to COMP-1 or FLOAT. When sending COMP-2 DOUBLE, you might set the type field to COMP-2 or DOUBLE. When sending BINARY fields, you can either set the type field as SHORT (2 byte), INTEGER (4 byte) or LONGLONG (8 byte), or you might set the type field to BINARY or COMP, and explicitly set the length using the precision field as described above.
When receiving records at the Subscriber, Packed Decimal field (COMP-3) message descriptions have to match what was sent from the Publisher. If the Publisher sent the data on the wire as DOUBLE, the type field have to be set to DOUBLE, and the convertTo option must be used, and set to COMP-3 or PACKED. If the Publisher sent the data on the wire as STRING, the type field have to be set to STRING, and the convertTo option must be used, and set to COMP-3 or PACKED. Sample definitions are shown below:
Sent as DOUBLE:
field = { fieldStart="4", precision="7,2",
          value="ITEM-PRICE", type="DOUBLE",
          convertTo=COMP-3" },
Sent as STRING:
field = { fieldStart="4", precision="7,2",
          value="ITEM-PRICE", type="STRING",
          convertTo=COMP-3" },

Copyright © TIBCO Software Inc. All rights reserved
Copyright © TIBCO Software Inc. All rights reserved