5.24 Ah ha! Gotcha!

When all the entries in a detail dataset are deleted programmatically the delete chain head is reset and subsequent DBPUTs start with the first record, then the second and so on (IMAGE tries to use entries from the delete chain first when doing DBPUTs unless HWMPUT is set). Well, not all the time.

It turns out there is a circumstance where this is not true. From Stan Sieler:

For the last DBDELETE from a detail dataset:

if the DBDELETE is done within a DBXBEGIN/DBXEND then don't reset the highwater mark and don't clear the free chain.

if the DBDELETE is not done within a DBXBEGIN/DBXEND then reset the highwater mark to 0 and zero the head of the free chain in the user label

The difference, according to HP, is to ensure the transaction can be rolled back if necessary. Which of course is the point in using DBXBEGIN/DBXEND. Unfortunately, this behavior does not appear to be documented anywhere and was known until recently only to a few, if any, people outside of the IMAGE lab.

So who cares, you ask? Isn't one of the reasons for the existence of database management systems the shielding from the user of the messy details of pointers and position? True enough. However, the difference became important if you were using dynamic rollback recovery (DBXBEGIN/DBXEND encapsulated transactions) and Netbase/Shareplex under TPS (Third Party Shadowing).

When DBXBEGIN/DBXEND IMAGE transactions are made on the master machine of a master/shadow system that result in the deletion of all records from a detail dataset, the delete chain is not reset and subsequent DBPUTs are thus located according to this delete chain. On the shadow side, the posting process makes only non-DBXBEGIN/DBXEND IMAGE calls. Therefore, in this case, these calls result in the delete chain being reset and subsequent DBPUTs start with the first record and so on. Netbase/Shareplex detects this inconsistency as an error and the database is flagged as out of sync.

Netbase/Shareplex has been altered to be DBXBEGIN/DBXEND aware. The point is that we all need to try to understand what is going on under the covers. Many fixes and enhancements come from an active, engaged user community.