These process points are accessible from the Events tab of the document function File Accessor’s property sheet.

Before Read - The logic to be executed immediately prior to reading the file. This is typically used for key initialization or to deselect the file.

on Lock - This logic is designed to take the appropriate action when the function tries to read a locked record. If a locked record is encountered and On Lock logic is not specified the system will perform as follows:

If the record is locked AND the field is an input field AND this is the first attempt to lock a record for this field
then
issue message: "Cannot obtain a lock - terminating read" and return to the input field.
else
issue message: "Record Locked – Waiting", continue trying to read and lock the record.

This means that if the function cannot read and lock the first record that it attempts to read for an input field, it will terminate the read and give the operator an opportunity to enter a different value into the field.

If a record has been read and locked for an input field and a locked record is encountered while trying to read a subsequent file, the system will advise the operator and wait for the lock to open.  This advice and wait behaviour also applies to a display only field.

With On Lock logic you can specify alternative action. The RETRY_READ() command will tell the system to continue trying to read after the first attempt failed because it was locked.  

The SUPPRESS_RETRY() command will stop the function  trying to re-read a subsequent file.  The logic can be used to check a system variable @RETRYCOUNT which will hold a count of the times the record has been unsuccessfully read.

On Error - The logic to be executed immediately an error condition has been detected during the read of a file.  If an error code is returned by the operating system it is placed in @SYSERR. If @SYSERR is set On Error Logic is executed. This is typically used to display custom error messages.

After Read - The logic to be executed immediately after a successful read of the file.  All data fields from the record that has been read are available to this logic at this time.

Before Write - The logic to be executed immediately before writing to the file. This is typically used to perform computations, initialise fields, or to deselect a record so it is not written.  

Before Write logic is executed in all modes, including Lookup mode, where no actual write to the file occurs.

Write Error - The logic to be executed immediately after encountering an error while writing to a file.  The error code returned by the operating system is placed in @SYSERR.   If @SYSERR is set, Write Error logic is executed. This is typically used to display custom error messages.

After Write - The logic to be executed immediately after writing to the file.

Comment on this topic

Topic ID: 500106