Form calls the user edit routine with the type parameter equal to U_PREPARE whenever the STORE key is pushed. The other parameters to the user edit routine are NULL. The record being stored could be either a new record being added or an old record being updated. If the user edit routine must know whether it is a new record or updated record, it should call the smode function. As mentioned before, all of the field edit checking is done before the user edit routine is called.
This function call allows the user edit routine to make any changes or additions to the record before it is to be stored in the RMSfile. Changes should not be made to other files at this time. The record has not yet been added to the RMSfile, and it is possible that the record cannot be added if, for example, the RMSfile is full. If the user edit routine returns an error message, the message is displayed on the screen, and the STORE is not attempted.
If the user edit routine does not return an error message from the U_PREPARE call, then form attempts to add or update the data record. First it performs edit checking in case the user edit routine changed the record. If any of the edit checks fails, form displays an error message and the STORE is not completed. If the edit checks are successful, the record is added or updated.