3.3.6 U_FIND and U_MATCH



Form calls the user edit routine with the type parameter equal to U_FIND each time the user pushes the FIND NEXT or FIND PREVIOUS key. The other parameters are set to NULL. The user edit routine is called before any search for a matching record is made. If the user edit routine returns an error message, no search is made. If it returns a NULL pointer, then form searches for a matching record.

When a record is found that matches the QUERY fields, form calls the user edit routine with the type parameter set to U_MATCH. The other parameters all contain NULL. This call is made before form displays the matched record on the screen. The user edit routine can inspect the record found (with the sread(C-3) function explained in Chapter 8, C/Base Functions) and decide whether or not the record should be displayed. If the user edit routine returns a NULL pointer, form displays the record and completes the FIND function. If a pointer other than NULL is returned, form does not display the contents of the record, and instead continues the search for other records that match the QUERY fields. Form does not display the message returned by your U_MATCH user edit routine; it just skips the record just found.

Form continues to find a record and call your user edit routine with U_MATCH until no more records are found or your user edit routine returns NULL.