Errors with COMP host variables after compiling on Windows and running on Unix

over 6 years ago


When SQL programs contain host variables that are declared as COMP, compiling with OpenESQL on Windows and moving the INT code to a non-Intel platform gives incorrect values in the COMP variables.


Database applications that use COMP host variables and are compiled with OpenESQL, can only be used on platforms with the same native byte ordering.

This is because the OpenESQL pre-compiler inserts additional code for COMP host variables on Intel (little-endian) platforms to handle the reverse byte ordering of COMP, compared to the native byte ordering.

Thus when you transfer the compiled code to a non-Intel (big-endian) system such as AIX, the additional code for handling COMP causes byte swapping problems.


There are two solutions to the problem:

  1. Use COMP-5 instead of COMP for host variables. This has the added advantage of being more efficient compared to COMP.
  2. Recompile the source on the target platform, as the OpenESQL pre-compiler will not insert the additional code for handling COMP's on non-Intel platforms.

Comment List
Related Discussions