|
Just a thought here, but why wouldn't you retrieve the contents of the file using a CHAIN(N) with no lock to get the information for the screen while saving the original data file information in a data structure, allow the user to mess with the data on the screen, and when they are finished rechain to the file to lock the record, make sure no changes had occured to the record while they were on the screen (by comparing the original record you retrieved with the record you just got, in case something changed it, at which point you'd give the user a message stating that the record has changed since they retrieved it and do they wish to overwrite, display etc...) then load their changes to the record and update it. Hence, no record locks, and your program controls the access instead of letting the display handle it. At least then you know what it is doing. Just a thought. Ron Power Programmer Information Services City Of St. John's, NL P.O. Box 908 St. John's, NL A1C 5M2 Tel: 709-576-8132 Email: rpower@xxxxxxxxxx Website: http://www.stjohns.ca/ ___________________________________________________________________________ Success is going from failure to failure without a loss of enthusiasm. - Sir Winston Churchill "Andy Hautamaki" <ahautamaki@xxxxxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx 07/10/2004 12:51 PM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> To "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> cc Subject Re: How to unlock a record in an interactive job after 'x' amountoftime has passed Hi Jonathan; No. Its to do with a display file. A user is in a maintenance program and for whatever reason is inactive in that application for 'x' amount of time and has a record locked. (Goes for coffee, lunch or whatever) In the meanwhile other applications are trying to grab that record and are repeatedly trying to access the record. (Record lock, retry, record lock retry, etc etc) So what I was trying to find out was a graceful way of unlocking the records from the maintenance program. Charles on a previous thread suggested I search the midrange archives and I came across the article by Shannon O'Donnell where using the display file and the 'INVITE' keyword and creating the display file with a 'WAITRCD' set at a certain 'x' value. (Thanks Charles, I should always look to the archives first before asking the question to the group, I bury my head in shame) Dan suggested using the data queue from an example that Scott Klement had posted a few years ago. Thanks Dan, that was something that shows promise and I'm going to experiment with that. I apologize if I didn't explain my question/problem thoroughly enough. Andy ----- Original Message ----- From: "Jonathan Mason" <jonathan.mason@xxxxxxxxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Thursday, October 07, 2004 10:57 AM Subject: RE: How to unlock a record in an interactive job after 'x' amountoftime has passed > Hi Andy, > > I'm not sure if I've got the thread of this thread or not. My first > reaction was that you were talking about database record locks and not > timing out of display files, which seems to be what most people are > answering about. Just in case it is database record locks, I'll add my two > pence (or cents for those in the US) worth... > > In RPG400 you would code an error indicator in the "less than" columns and > test for that immediately after the chain or read. For example: > > KEY CHAINFILENAME 9192-- > *IN92 IFEQ *ON > ...error processing... > ENDIF > > In RPG ILE you can achieve the same thing with the following > > Key Chain(E) FileName > If %Error > ...error processing... > Else > If %Found > ...record found... > Else > ...record not found... > EndIf > EndIf > > This will pick up all errors associated with the Chain (or Read). If you > want to specifically test for a record lock then within you can use > > If %Status = 01218 > > The WAITRCD attribute on the physical file is the length of the time that > ANY program will wait for a record to become available if it is already > allocated to, i.e. locked by, another job. Whenever you do a Chain or Read > to an update file the program will wait this amount of time before returning > a "locked" error. If you are using an error indicator or the (E) opcode > extension and %Error function then error control is passed back to your > program. The default for the WAITRCD attribute always used to be 60 > seconds. > > Hope that helps > > Best regards > > Jonathan > www.astradyne-uk.com > > > > > -----Original Message----- > From: rpg400-l-bounces+jonathan.mason=astradyne-uk.com@xxxxxxxxxxxx > [mailto:rpg400-l-bounces+jonathan.mason=astradyne-uk.com@xxxxxxxxxxxx]On > Behalf Of Andy Hautamaki > Sent: 07 October 2004 14:45 > To: RPG400-L@xxxxxxxxxxxx > Subject: How to unlock a record in an interactive job after 'x' amount > oftime has passed > > > Is there a way from a RPGLE interactive program to track how long it has a > record locked in update and after a certain amount of time has elapsed, > gracefully unlock the record. Then the interactive program would show some > info message to inform the User that they will need to retrieve the > transaction again. > > Thanks > Andy > > -- > 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. > > > > -- > 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. > > -- 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. This e-mail communication and accompanying documents is intended only for the individual or entity to which it is addressed and may contain information that is confidential, privileged or exempt from disclosure under applicable law. Any use of this information by individuals or entities other than the intended recipient is strictly prohibited. If you have received this in error, please notify the sender and delete all the copies (electronic or otherwise) immediately.
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.