× 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.



As others have mentioned, if your talking about DB2 for i, there's rrn()...

Note however, that contrary to logic...using WHERE RRN(tbl) = 1
causes a FULL TABLE SCAN, not random I/O!

You'll find some similar functions in other some other DBs, Oracle for
instance has the rowid() function.

But MS SQL Server doesn't officially offer anything comparable, but it
looks like there's at least 1 unsupported method...
http://stackoverflow.com/questions/909155/equivalent-of-oracles-rowid-in-sql-server
But again, using the above solution forces a full table scan.

Also as mentioned, when using a cursor to read a results set, you can
UPDATE WHERE CURRENT OF...looks like JDBC 2.0+ offers "updatable resultset"
JDBC 1.0 used the actual WHERE CURRENT OF syntax

Basically, it boils down to the idea that physical location of the row
isn't supposed to matter in an RDB and that having tables without a unique
key is bad.

I've used tools in the past that simply don't offer update functionality
for tables without a unique key, including IBM's own CPYF MBROPT(*UPDADD)
:D

Personally, that's the route I'd take.

Charles





On Fri, Dec 28, 2012 at 1:54 PM, James H. H. Lampert <
jamesl@xxxxxxxxxxxxxxxxx> wrote:

I'm beginning to study Scott Klement's JDBCR4 API, as a means of
extending our QuestView product to access external databases (and it
would also allow us to expand our very limited support of data types
that are normally SQL-only), and something suddenly struck me:

Suppose I'm looking at a record, and I decide to make a change to it.
And the file isn't uniquely keyed.

Now, with native RLA, we can easily determine the RRN of the record
we're looking at, and acquire an update lock on that record by its RRN.
After all, RRNs only change if a RGZPFM is done, and that requires an
exclusive lock on the member.

But now, suppose I have to use SQL, JDBC, and the JDBCR4 API. I'm no
expert on SQL (SQL for Dummies is still my primary reference on the
subject), but I don't recall ever reading anything anywhere about a way
to get a record's RRN, or retrieve a record by its RRN, from SQL.

I must be missing *something* here, but what? How do I guarantee that an
update will go to the right record, when I initially read it without a
lock, and apparently can't grab a lock on it by its RRN?

--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.