|
Hi Andy In that case, instead of modifying the display programs to have automatic timeouts and then release the record you should code the program so that it doesn't lock the record in the first place, and only lock the record when you are reading the file prior to the actual update/write operations. In the good old days we used to have a logical with the same key structure as the physical. The physical was always used for the update/locking reads and the logical for input only. These days I use the (N) extender on the chain/read opcodes so that the record isn't locked, and don't use when I want to lock the record. On every file I always code an Update No field (3.0 packed) which I increment by 1 before updating the record. That way when I read for the update, I can compare the value of the field against the value when I read without locking the record and if it's different I know somebody else has updated the record between times. All the best Jonathan www.astradyne-uk.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Andy Hautamaki Sent: 07 October 2004 16:22 To: RPG programming on the AS400 / iSeries 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.
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.