Mismatching global variable definitions

The c4gl C-code compiler of IBM® Informix® 4GL has a weakness that allows global variable declarations of the same variable with different data types. Each different declaration found by the c4gl compiler defines a distinct global variable, which can be used separately. This can actually be very confusing (the same global variable name can, for example, reference a DATE value in module A and an INTEGER value in module B).

IBM Informix 4GL RDS (fglpc / fglgo) does not allow multiple global variable declaration with different types. The fglgo runner raises error -1337 if this happens.

The next code example shows two .4gl modules defining the same global variable with different data types:

Main.4gl:
GLOBALS
  DEFINE v INTEGER
END GLOBALS
...
MAIN
  ...
  LET v = 123
  ...
END MAIN
Module.4gl:
GLOBALS
  DEFINE v DATE
END GLOBALS
...
FUNCTION test()
  ...
  LET v = TODAY
  ...
END FUNCTION

The fglcomp tool compiles both modules separately without problem, but when linking with fgllink, the linker raises error -1337.

You must review your code and use the same data type for all global variables having the same name.