About -4518 again
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
From: evdh@csl.sni.be (Eric Van der Hulst)
Newsgroups: comp.databases.informix
Subject: Re: Error -4518 when using print xxx wordwrap
References: <2pr7iu$go5@eldborg.rhi.hi.is>
Organization: Siemens Nixdorf
X-Newsreader: WinVN version 0.82
In article <2pr7iu$go5@eldborg.rhi.hi.is>, gaukur@rhi.hi.is (Kristjan Gaukur Kristjansson) says:
>
>Im using I4gl 4.10.UD2 and the following program crashes. Any explanations?
>Should the 'wordwrap' function be avoided?
Hi,
I'm glad somebody mentions error 4518. I've just lost 4 days and brought
down our whole database ( where was the backup? .. right ) searching for
this error.
I'm working with Informix 4.0 and 4GL.
My experiences:
- The error messages manual 5.0 talks about functions returning
long character strings, but also mentions two bugs in 4.0 and 4.1 regarding
concatenation of strings ( use CLIPPED ) and CASE for characters variables.
All very awkward!
- In my case I used an iterative loop and call a number of functions
that return small character strings.
..loop thousands of times CALL PlanAdapt
FUNCTION PlanAdapt ( ... )
...
IF yearOk
THEN
CALL PlanCheckCFraisNatureInPlan(...t)
CALL PlanUpdateDebitCredit (...)
CALL ParAdaptSigDebitCredit(...)
END IF
END FUNCTION
FUNCTION PlanUpdateDebitCredit ( ecriture )
LET monthAbbrev=bar..()
LET annee = foo(..)
LET currentYear = annee CLIPPED
END FUNCTION
FUNCTION bar
CASE
WHEN monthNumber=1 LET monthAbbrev = "jan"
WHEN monthNumber=2 LET monthAbbrev = "fev"
...
WHEN monthNumber=11 LET monthAbbrev = "nov"
WHEN monthNumber=12 LET monthAbbrev = "dec"
END CASE
RETURN monthAbbrev
END FUNCTION
FUNCTION foo
SELECT anencour
INTO annee
FROM par_analy
WHERE par_analy.noanalyt="01"
AND par_analy.nhop=ecriture.nhop
RETURN annee
END FUNCTION
I searched and found that it must be the stack that is not correctly
freed when the function are left. I made foollowing changes
- Eliminate cases where you use a call of a function as value
without storing it into a variable ( f.e. RETURN fctname() )
- Eliminate the small functions and put the code into the
next level ( there goes my 'structured programming')
this is the worst programming language I've ever seen ( or at least the
compiler is.)
Anyone for comments?
Greetings Eric.