Make sure you have closed all db connection at the end.
Make sure there is no incomplete loopings (i.e. for and next) or conditions (i.e. if and end if). If you forget 'end if', error will be prompted. The same for subrountine (i.e. sub xxx() and end sub).
When using include file, make sure you not redefine the %@LANGUAGE="xxxSCRIPT".