` Printed Icetips Article

Icetips Article



Par2: Recover() - recovering held records
1998-05-05 -- Maarten Veenstra
 
From the help-file:

SEND(file,'RECOVER=n')

The RECOVER string, when n is greater than 0, UNLOCKs data files, RELEASEs held
records, and rolls back incomplete transactions in order to recover from a system crash. 
See also Transaction Processing for Clarion Files.

n represents the number of seconds to wait before invoking the recovery process. 
When n is equal to 1, the recovery process is invoked immediately. When 
n is equal to 0, the recovery process is disarmed.

There are two ways of using RECOVER:

SEND(file,RECOVER=n)
OPEN(file)

This releases a lock on a file that was locked when a machine crashed. It also rolls 
back a transaction that was in process when a system crashed.

SEND(file,RECOVER=n)
GET or NEXT or PREVIOUS

This removes a hold flag on a record from records that where held when a machine 
crashed.  Here is a piece of code that removes all hold flags from a file:

OPEN(file)           !make sure no one else is using the file
SEND(file,'IGNORESTATUS=ON')
SET(file)
LOOP
 NEXT(file)
 IF ERRORCODE() THEN BREAK.
 IF SEND(file,'HELD') = 'ON' THEN
  SEND(file,'RECOVER=1')
  REGET(file,POSITION(file))
 END
END

RECOVER may not be used as a DRIVER string--you may only use it with the SEND 
function. The SEND function returns a blank string.



Printed November 21, 2024, 12:48 pm
This article has been viewed/printed 35184 times.