User-Defined Interface for File Maintenance
From PxPlus
As of Version 9, PxPlus has added the ability to extend the standard file maintenance utilities in order to intercept file updates.
Interface Points
Each file maintence panel can have an unique interface program assigned to it in the File Maintenance 'Options' tab. This program will be performed at a number of pre-defined entry points, each prefixed with FM_.
The supported entry points are as follows:
| Entry Point | Description/Function | FM_INIT | Performed once at initialization. | FM_POST_DISPLAY | Performed at Post-Display. | FM_WRAPUP | Performed in Wrapup (Generally used to close any files opened during the process) | FM_PRE_WRITE | Performed before the record is written. Generally this function will validate the contents of the record in order to determine if it should be written. The logic should display an error message and return with an error exit if the record is rejected (error code will not be used). | FM_POST_WRITE | Performed after the record has been written. Allows the program to adjust any other related files. | FM_PRE_REMOVE | Performed before the record is removed. Generally this function will determine whether the remove is allowable. The logic should display an error message and return with an error exit if the record is rejected (error code will not be used). | FM_POST_REMOVE | Performed after the record is removed. Allows the program to adjust any other related data files. | FM_POST_READ | Performed after the file is read. This entry point can be used to read additional information or return an error which indicates the record read is not to be presented to the user (application security). |
|---|
Missing entry points are ignored.
Data Validation/Rejection
To allow the interface to validate the function being performed, the system will check the value returned in _IF_ERR$ to see if an error occurred. For example, if the logic in the FM_PRE_WRITE entry point determines that the record is not to be written, it can simply set the string _IF_ERR$ to the desired error message end exit. The WRITE will not occur.
The interface program itself may handle displaying the error message or may interact directly with the user to cancel the WRITE/REMOVE procedure. In this case, it can set _IF_ERR$ to a single space which will indicate that the operation is not to be performed but no message is required.
For the POST_READ entry point, rejecting the data will cause the current record not to be displayed. If the user is browsing the file (Next, Prior, First or Last button) then the system will continue to advance to the first record that is not rejected. This can be used as a means to suppress certain records on the file.
Should an error occur within the interface program, it will be reported by the file maintenance utility and the record will be considered as rejected. If desired, an error EXIT of a status > 512 may be used to reject a record without any error report.
