What causes an Error 78 and/or sometimes "phantom" records in a browse?

I have a Browse / Form that from time to time when the user Clicks on the from OK it gets error 78.
Any way of inspect the ViewPosition Value?

You could edit the template and put in something to log the value, at least while diagnosing it. Unless you can repeat the problem on demand, then step through with the debugger I suppose.

In Clarion 10 in ABBrowse.TPW ViewPosition size is generated from a call to %ConstructQueue 4th parameter which is omitted and defaults to 1024.

Change
#INSERT(%ConstructQueue,'Queue declaration for browse/combo box using '&%ListControl)
To
#INSERT(%ConstructQueue,'Queue declaration for browse/combo box using '&%ListControl,2048)

Changed all 1024’s to 2048 in ABBrowse.clw, ABFile.clw, ABWindow.inc. I’m not using VCR and RelTree.

Just for the notes, I reported the issue to SV a while back and they have marked it as bug confirmed:

Sorry, seems that 2048 was not enough, i should have used 10000.

In ABBrowse.tpw there is also this function which is called without parameters for a filedrop control (and in ABCFree).
Change:
#GROUP(%ConstructQueue, %pDescription=’’, %pAddMark = %True, %pPositionSize = 1024)
To
#GROUP(%ConstructQueue, %pDescription=’’, %pAddMark = %True, %pPositionSize = 10000)

In ABFile.clw there is another position variable:
SaveQueue QUEUE,TYPE,PRIVATE
Pos STRING(10000)

Please Note,

Originally after discussions in the clarion skype chats, I tried to use ANY for the position fields.

This caused a number of issues back when I did it, and so eventually I changed the ANY’s to STRING(10000). This is not perfect, but it’s what it is

2 Likes

After changing all ANY’s to a 10k STRING the error was still there.
I found a post on TekTips that seems to solve ERROR78 for us now

Hi All,

Thanks for this, it solved a problem I had with Easy Multi Tagging.

Hi everybody,

I use to fix this error by declaring the following variable in the offending Browse procedure:

ViewPosition STRING(2048)

and then adding a hot field to the browse extension:

immagine .

When the procedure is compiled a warning is reported but it’s ok because the browse QUEUE has two ViewPosition fields and we want that the first one (the one we just added) is used:

immagine

Hope this helps,
–Alberto

mmmm
Not work for me…
But in a Browse where error 78 occurred frequently, remove the Tooltips … and the error did not occur again.

I managed to fix this error consistently for me - I have had this problem in 6 different areas of my app.

I declared aliases for the offending tables and then used them and my problemswent away.

The post here WindowManager.Update calling BrowseClass.UpdateViewRecord - RC = ErrorCode() - Error 78 Invalid Number of Parameters contains a fix which should sort out the error 78 issue. Position() is sometimes too big for the Queue ViewPosition which is 1024 chars.

Thanks Richard,

That was one I had found but I note I had not documented it above.

I also found issues in 3rd party templates, I would have to go back and check which ones, but I remember Mike @BoxSoft uses 1024 in a product of his. Again, I’ll have to dig through my changes.

By all accounts, I don’t think SV are keen to change the size, I use 10000, but I do understand that might be overkill for some.

Mark

The problem is the TPS file specs allow keys upto 15,000 bytes in size, so the ABC templates needed to be made to work with the TPS file specifications as a minimum.

Once I’d established the clarion debugger was giving me duff info which was messing me around, that template hack seemed like the best workaround. Any other problems in the classes should get highlighted very quickly and I note there are other places in the ABC classes where local variables could be too small or the wrong type, I havent looked at your ANY data type changes yet in any great detail.

But this template hack to make Q ViewPosition the same size as the key length + 4 bytes output is a minimum to get the ABC classes to work with Position().

I had Mikes tagging templates along time ago, I cant say I remember it using Q ViewPosition, I know it had its own files which had to be added to the dict to store the any tagged browses, but I never saw any code where it used Q ViewPosition, but maybe I wasnt looking hard enough.

One other thing I did learn, is that it wasnt a Brit who wrote the StandardBehavior ABC class because the U isnt used, unlike here in the UK where U is used in the word Behaviour which draws its roots from France and the land owning Normans…

Like you have documented, there are restrictions in the class methods with local variables so I might need to still apply those changes you have documented but I havent come up with any tests which make it fail, unless you’ve got some tests which will make a class method fail?

I’ve been modifying the ABC classes in places to make it less obfuscated as well, it then gets easier to see WT_ is going on. :grinning:

Perhaps TPS files can theoretically support a key that large, but it’s a terrible idea to actually do that in the real world. :smiley:

Why, are you forgetting that SSD & NVMe drives exists now and they are not that much slower than memory chips?

SSD vs HDD - Comparing Speed, Lifespan, Reliability (tekie.com)

The NVMe’s I have are so quick, that it gives TPS’s files and other ISAM db file technology a new lease of life. I havent even bothered getting the In Memory Driver out to improve performance, NVMe are that quick!

Spin Disks today still have, at best, a seek time of 4ms, SSD’s et al typically 0.1ms and the data throughput on SSD et al are at least twice as fast out the box compared to spin disks.

Spin disk only bring reliability.

I understand what you’re getting at. However, keys that large tend to represent rather specific sort situations. I typically use keys with fewer components, as it will narrow the selection of records that need to be sorted by the additional values. It’s just a matter of whether you do that sorting when you first add the key (making ADDs a bit slower), or whether you do the sort later (making your reads a bit slower). You pick your poison.

Remember that TPS files aren’t as stable as SQL. They tend to corrupt, and don’t work well in heavy multi-user situations (especially if a record add requires that many keys be updated). Also, OpLocks et al. need to be adjusted away from the Windows default.

If this is a single-user program, or primarily read-only, then this caveat probably doesn’t apply.

Hi Mike

In our case we were getting the ERROR 78 with SQL.

When debugging why we were getting the error, and that was fun, we found that POSITION was returning long strings. All our KEYS are < 1024 characters in size, so in SQL’s case it seems the problem is not just down to cutting back KEY size.

We decided to increase the size of all variables that were to store POSITION throughout the classes and templates. We didn’t run testing on each scenario but decided that the hammer fix was better than keep trying to debug the issues caused by error 78.

Thankfully since that day we haven’t had many more error 78’s and none of the ones we have had were down to position.

Mark

1 Like

Thats the key, horses for course.

Thats debatable. They both suffer the same risks of disc corruption, if not running a RAID config. Out the box the TPS is not designed for heavy multi user situations, where as SQL is, but thats not to say a class that incorporates the features of sql couldnt be made. TPS hasnt had as many design hours spent on it, unlike SQL servers, so its like comparing Apples with Oranges, but the new drives still give TPS and other ISAM db files a new lease of life, which is perhaps why free versions of various SQL servers have been made available, but these SQL servers need alot more resource to work, so in a limited resource environment, TPS & other ISAM db files still out perform SQL server with perhaps the exception of SQL lite, because they can work in a limited resource environment.

Edit

One other point, MS SQL server is an attack vector Server-side attacks, C&C in public clouds and other MDR cases we observed | Securelist
Trying getting your TPS files to hack back! :rofl:

1 Like

I think its not the one Primary File’s Key Position Size, but that the Browse uses Position(View) that includes position info for the Secondary Joined Files. I pasted info in the below topic. Also 1 post lower down a quick idea to throw the LEN(Position(View)) in the Browse to see it.