× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Justin,

Relying on DB2 "ROW CHANGE TOKEN" if the table does not have a ROW CHANGE TIMESTAMP column is risky, as there exists the possibility of "false negatives."  The IBM i DB2 for i 7.2 documentation does not explain this very clearly, it says only:

The ROW CHANGE TOKEN expression can be used for both tables that
have a row change timestamp and tables that do not.  It represents a
modification point for a row. If a table has a row change timestamp,
it is derived from the timestamp.  If a table does not have a row
change timestamp, it is based on an internal modification time that
is not row based, so is not as accurate as for a table that has a
row change timestamp.

The DB2 for LUW documentation says this:

Granularity of row change tokens and false negatives
...

*

The table does not have a row change timestamp column:  a ROW
CHANGE TOKEN expression returns a BIGINT value that is shared by
all rows located on the same page. If one row on a page is
updated, the row change token is changed for all rows on the
same page. This means an update can fail when changes are made
to other rows, a property referred to as a "false negative."

* The table has a row change timestamp column: a ROW CHANGE TOKEN
expression returns a BIGINT derived from the timestamp value in
the column. In this case, false negatives may occur but are more
infrequent. If the table is reorganized or redistributed, false
negatives can occur if the row is moved and an application uses
the RID_BIT() value.

Draw your own conclusions.  Henrik's technique is simple and time-tested and "proven" over the years. (For example, the LANSA product uses a variation of this technique for all FILEs defined as "maintained by LANSA.")

(You could just use a ROW CHANGE TIMESTAMP column directly in your applications to detect changes to the row by another user or job.)

Hope this helps,

Mark S. Waterbury

> On 12/21/2017 9:34 AM, Justin Taylor wrote:
Henrik, you have a legacy system that's been proven in production for many years, and you don't want to change it. I can see that. What I can't see is people encouraging users to ignore IBM supplied tools and to reinvent the wheel on their own.

Db2 will give you a row token on read (no table changes required). If the token matches when you do your update, you're guaranteed that the row hasn't changed in the interim.



-----Original Message-----
From: Henrik Rützou [mailto:hr@xxxxxxxxxxxx]
Sent: Wednesday, December 20, 2017 2:07 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: Re: 5250 and un-do

If you really want to know it, it's and old habbit that goes back to 1977 - and if it isn't broken, works well and suits the purpose - why try to fix it?

And even in 2017, where timestaming isn't enough any more (no ns support) - it still works ;-)




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.