Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE

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

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


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.


Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2015-01-14 16:37
Updated by:
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.