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



You should not be locking records during a maintenance transaction if that
transaction is known to experience the "gone to lunch" issue.
Use the CHAIN(N) option to get/display the data. Then when ENTER is pressed,
re-access the record and post the updates.
Granted, this technique does require either a timestamp in the record to
verify that the record was not updated between the CHAIN(N) and the re-CHAIN
without the (N) after Enter is pressed. Alternatively if you don't have a
"date last changed" field in your database record, is to simply compare the
old values to the new values.
In RPG IV at V5R1 and later, the ability to compare a before and after image
is so incredibly easy you're foolish to not do it.
FCUSTMAST UF   E       K  DISK   PREFIX('CM.')

D CM     E DS            EXTNAME(CUSTMAST) QUALIFIED
D BEFORE E DS            EXTNAME(CUSTMAST) QUALIFIED

C       CustNo    Chain(n)  CustRec
C                 eval       Before = CM
C                 exsr        MoveFieldsToTheScreen
C                 EXFMT
C       CustNo    Chain      CustRec
C                 if         Before <> CM
 **   Record has changed since Update was requested. Do something!
C                 endif


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Andy Hautamaki
Sent: Thursday, October 07, 2004 10:22 AM
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 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.