|
David Gibbs (devdmg@silvon-server.uisinc.com) wrote: >> 2 users access the same account number at the exact same time in the >> same file and same interactive job and are presented with a full >> screen where 20 comment lines can be typed in. > >If the file is opened for update, only 1 of those users will actually >get the record locked. As soon as the record is retrieved, update >the record with a flag to indicate that it's being maintained. The >other user's program should check this flag and disallow maintenance >if it's set. > >When the first user is done, re-read the record for update, clear >the flag, and update the fields. and Jorge Moreno (jmoreno@militarycars.com) wrote: >I hope I can help you with this: If the account number does not exist in >the file write and immediatly read for Update. If the account >number exists read the record for update. The AS/400 Data Management will >provide the record lock and you will be in charge in your >program/application to update the record at your convenience and remove all >phantom updates. Both these solutions have drawbacks. Setting a flag in the record leaves the possibility that the flag might never get reset if the job should fail. The record lock is the simplest method but many people consider it bad practice to hold a lock while waiting for a user response. The user may have to take a phone call or decide go to lunch or even go home for the day at that point. The same thing applies with the flag. An alternative is not to hold a lock while the user is keying data, then to re-read the record for update (locking it) and see if it's changed since the previous read. If it hasn't changed, update it; if it has changed, release the lock, show the new details to the user with a suitable message. How do you test whether the record has changed? Method 1 - store the entire record and then compare the current value of each field that your update would change with its stored value. Method 2 - have an update time stamp on the record and simply compare that with it's previous value. Dave Kahn - TCO, Tengiz, Kazakstan ========= e-mail: kahn@tengizchevroil.com (until September 30th) dkahn@cix.compulink.co.uk (from October 1st) +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to "MIDRANGE-L@midrange.com". | To unsubscribe from this list send email to MAJORDOMO@midrange.com | and specify 'unsubscribe MIDRANGE-L' in the body of your message. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.