informix problem
Posted in 2004
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL
Hi, I have a question about informix 4gl. In my 4gl program, statemnts as follows ... main ........ let err=op2() if err >=0 then display ' errors here ....' rollback work end if end main functon op2() if .... return 1 end if end function I tried to get the value returned from function op2 into variable err . And if err> 0 then that means that are mistakes there , the program should rollback everything and stopped . I checkd the data ,op2() should return 1 ; but it doesn't . It did not act the way I want . I don't know what's wrong there . Please give me some advice here. thanks in advance any message from you will be appreciated
daisy wrote: > Hi, > I have a question about informix 4gl. > In my 4gl program, statemnts as follows ... > > main > ........ > let err=op2() > if err >=0 then > display ' errors here ....' > rollback work > end if > end main If 0 = OK and 1 = error then you should test for err not equal to 0 > > functon op2() > > if .... > return 1 > end if > > end function > What does op2() return if there's no error ? In 4GL boolean TRUE has the value 1 and FALSE 0 or NULL. You can use TRUE and FALSE in statements. Using booleans the structure could look like this: function op2() ... if error condition then return FALSE end if return TRUE end function main ... if op2() then commit work else rollback work display error msg end if end main > I tried to get the value returned from function op2 into variable err . > And if err> 0 then that means that are mistakes there , the program > should rollback everything and stopped . I checkd the data ,op2() should > return 1 ; but it doesn't . It did not act the way I want . > > I don't know what's wrong there . > Please give me some advice here. > > > > thanks in advance > any message from you will be appreciated