RE: Informix C-compiler Version does not initialize variables?
Posted in 1995
Make sure that param3 had been initialized to a null in the calling function. Defining the param3 in the calling function does not guarantee its initial value. Example: initialize param3 to null or let param3 = ++ ---------- From: ilist To: internet!rmy.emory.edu!informix-list Subject: Informix C-compiler Version does not initialize variables? Date: Friday, March 10, 1995 1:29AM Hello, We've go a program fragment like this: (clipped to minimum so syntax isn't correct) FUNCTION hello(var1, var2, var3) ... DEFINE var3 like sometable.somecol . . IF var3 IS NULL THEN # do this thing ELSE # do another thing END IF The function is called like this: CALL hello(param1, param2, param3) The problem occurs when param3 is not set to any value (only defined like this 'DEFINE param3 CHAR(5)', no param3 = "" or initialize param3 to null or param3 = "value"). THe program goes into the 'do other thing' part instead of the 'do this thing'. I tried adding this code to the function hello, above the IF statement so that I can trace the variable var3 is being set to: ERROR "this is var3: ", var3 It showed me the following everytime I ran it: this is var3: >`@ There is something wrong here bec. this code worked on c4gl version 4 4gl on AT&T Unix SysV3.2 with version 4 SE. Now that we have version 4.12 4gl, C-compiler version on SCO unix 3.2.4 with 5.02 SE, it just doesn't initialize the variable correctly. Can any one suggest a solution? I can't just initialize var3 to NULL because param3 might have a value. This is what I have already tried (but failed) IF var3 IS NULL OR var3 = ">`@" THEN ... Pls. email your thoughts/solutions. Thanks! John -- - J -