File Process Points |
DEVELOPER |
Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > File Process Points
There are eight File Event Process Points available; Key Mapping on Sort, Before Read, Before Read, On Lock, On Read Error, After Read, Before Write, On Write Error, and After Write. This is the same for all function types.
Key Mapping on Sort/Select - The logic associated with this event process point is performed before a file is read during the Sort/Select system pass. This logic can use data from a previously read file to set the key fields for the records to be read.
Before Read - This is the logic to be executed immediately prior to reading the file. This is typically used for key initialisation or to de-select the file.
On Record Lock. Logic associated with this event process point is designed to take the appropriate action when the function tries to read a locked record.
If a locked record is encountered and On Record Lock logic is not specified the system will perform as follows:
If the record is locked AND |
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 Read Error - This is 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 Read Error logic is executed. This is typically used to display custom error messages.
After Read - This is 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 - This is 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. |
On Write Error - This is 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, On Write Error logic is executed. This is typically used to display custom error messages.
After Write - Any logic associated with this event process point is performed immediately after writing to the file.
Topic ID: 520011