|
And I've seen this technique outlined in a book from IBM. The book was quite old when I saw it 15 years ago. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin "Booth Martin" <Booth@xxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 08/08/2003 11:15 AM Please respond to RPG programming on the AS400 / iSeries To: <rpg400-l@xxxxxxxxxxxx> cc: Fax to: Subject: Re: user with a record lock Another choice is to find where in the program the record has a situation where there is a prolonged lock. Then change the code. Generally there is little business need to create an extended locking period. Here is an algorithm that works in most situations: Define 3 data structures, the first externally described with the record format, the other two like the first one. I use "OriginalValuesDS", CurrentValuesDS", and "NewValuesDS" read the record (don't lock it) and move the data into "OriginalValuesDS". do the processing. Move the new values into "NewValuesDS". chain again, locking this time. Move the record values to "CurrentValuesDS" If CurrentValuesDS = OriginalValuesDS then do the update. if CurrentValuesDS <> OriginalValuesDS then the record was changed at another workstation and you can decide what happens then. You can even do a field by field compare, and if the changed fields don't conflict, do the update. For example, if one user changes the phone number and the another user changes the zip code then there's no conflict to resolve. Accept both changes. This may take a little while to implement, but probably not all that much longer than establishing who has the record locked, and in my opinion it is a much more elegant solution. --------------------------------------------------------- Booth Martin http://www.MartinVT.com Booth@xxxxxxxxxxxx --------------------------------------------------------- -------Original Message------- From: RPG programming on the AS400 / iSeries Date: Friday, August 08, 2003 10:17:08 AM To: rpg400-l@xxxxxxxxxxxx Subject: user with a record lock I am having difficultly with what I thought would be a simple thing to do. When a user tries to update a record that is locked by another job, I want to tell the user not only that the record is locked but who has the record locked. I am trying to use the the API QDBRRCDL since it would return all the info I would need. I can get the Library/File/Member name from the INFDS but the all alusive relative record number I don't have because I didn't have a successful file operation. The RRN comes back as a big fat ZERO. I could do a CHAIN(N) right after my error to get the proper RRN but that seems very cumbersome and expensive. I also could leave the RRN at ZERO and it would send all the records that a have a lock. That again would seem cumbersome and expensive to figure out which one I really want. Am I missing something???? Is there another API? Daniel _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.