Assertion Failed using close(file)


#1

Hi All
I have a problem with this message appearing
Assertion failed on line 506 of ABFILE.CLW
You are calling CLOSE(COMPANY) instead of filemanager…

Now the fun bit is Close(Company) or indeed Open(Company) does not exist in my code. I’ve search the entire source directory and it just does not exist. Only ABC methods are used.

So I’m thinking this is a red-herring, but I don’t know.
Any ideas on what might be going on?


#2

@Bruce, is this one you can help with?


#3

Sean,

I believe this error also appears if an unmatched ABC method close or open is used.
I have seen it too at times and I also only use ABC FileManager method calls.

Douglas


#4

Sean, if you have FM3 in the program this assertion will fire.
Easiest solution is you can comment it out and the assertion at line 527.
In Clarion10 there is a new global template setting you can set in the data dll, but it requires you to set it for every table in your dictionary. Not very useful.


#5

Along with what @Rick_UpperPark has said, Capesoft have a little Utility template to make it easier to set this at the global level rather than for each individual file.


#6

Nice. I didn’t know about the Capesoft template.


#7

Since you’re not actually calling CLOSE(Company)
then I wouldn’t just suppress the message, It’s there to help you.


If you do have a valid reason to suppress the message, you can use my debuger class
which hooks assert, and has a special match system to look for messages and decide what to do with them.
I wrote that match system for Kelly Major, who was closing a file outside of ABC and the abc method was messing with him.

see the notes in the Debuger.AddAssertMsg method for this exact assert message


#8

Thanks Mark. But I’m a little concerned about the cause. I’d like to get to the root of the problem.
So I’m going to attempt to trace and see if I’ve got any opens without a close somewhere.


#9

Sean,

Are any SQL filter/order errors associated with the problem?


#10

This may be a long shot but I have been caught out by using the same name for two elements that are not the same structure. CLOSE() is quite an overloaded function. Normally the compiler gets confused, so you can’t complete but it might get through and the wrong thing gets closed in compiling. It might be worth searching the whole project for ‘COMPANY’ just in case you have another COMPANY structure that gets closed too?


#11

@totalhip On occasions yes. not 100% sure if filters involved.
@JimM Thats worth a try. Certainly can’t hurt.

Thanks