Salesforce

Binary dump/load between OS with different endianness corrupts float values.

« Go Back

Information

 
TitleBinary dump/load between OS with different endianness corrupts float values.
URL Name000055512
Article Number000170358
EnvironmentProduct: Progress
Version: 8.x, 9.x
Product: OpenEdge
Version: 10.x, 11.0x, 11.1x, 11.2x, 11.3.0, 11.3.1, 11.3.2
OS: All supported platforms
Other: Migration, Binary D&L
Question/Problem Description
Binary dump/load between OS with different endianness corrupts float values.

Data stored as float are not converted correctly when binary dumped and loaded between two systems of different endianness.

When using binary dump and load to move data between systems of different endian, data of float datatype is incorrect in the loaded database.

Data displayed in a float field are not correct after data are binary loaded from a different endian machine.
Steps to Reproduce
Clarifying Information
Binary dump (.bd) file from HP-UX Ia64 (Big Endian)
Loaded on either Windows or Linux x86 (Little Endian)

Example: INVOICEAMOUNT field is of float(8) type:

Pre-dump on Unix:

 PROCESS_INSTANCE_ID          INVOICEAMOUNT
-------------------- ----------------------
                3489                  15.17
                3491                 904.16
                3493                3387.69
                3495                 3180.0
                3497                 4589.5
                3499                 3000.0


Post-load on Windows/Linux(x86):

 PROCESS_INSTANCE_ID          INVOICEAMOUNT 
-------------------- ---------------------- 
                3489   9.45874672603115E-13 
                3491   -1.0295114965238E-86 
                3493    1.99915928352293E37 
                3495      2.6798297704E-315 
                3497      2.6813004259E-315 
                3499      2.6796021049E-315 
Error Message
Defect NumberDefect PSC00301809
Enhancement Number
Cause
Binary load does not alter the records in the binary dump (.bd) files and expects the records to be in machine independent format.
In this example:
DOUBLE fields (_field._data-type = "double") are not stored in machine independent format.
Resolution
Upgrade to OpenEdge 11.3.3, 11.4.0 or later. 
  • Binay dump was enhanced to store machine endianness information to the dump header when the table contains DOUBLE field(s).
  • Binary load was enhanced to verify if the dump header contains machine endianess information and will convert the fields to match the target machine. 
  • For binary dump (.bd) files created prior to this enhancement, OpenEdge 11.3.3, 11.4.0 or later binary load will first prompt for machine endianess information.
Workaround
Prior to binary dumping out data, find all float columns and the containing tables, then use the output to generate conversion scripts. 

Example: 

1.  
Find all tables that have float columns
 
select tbl,col from SYSPROGRESS.SYSCOLUMNS where coltype = 'float'.

2.  For each float column, generate a script by querying the original tables. 
 
select 'UPDATE INVOICE set INVOICEAMOUNT = 
' + convert('varchar(50)', INVOICEAMOUNT) 
+ ' where process_instance_id=' + convert('varchar(50)',PROCESS_INSTANCE_ID) from INVOICE

The result of this query generates one line of script for each record in the table that needs to be run against the target database to fix these fields:
 
… 
UPDATE INVOICE set INVOICEAMOUNT = 15.17 where process_instance_id=3489 
UPDATE INVOICE set INVOICEAMOUNT = 904.16 where process_instance_id=3491 
UPDATE INVOICE set INVOICEAMOUNT = 3387.69 where process_instance_id=3493 
…

 
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:04 AM

Powered by