Implementing Query-by-Example

This program implements query-by-example, using the CONSTRUCT statement to allow the user to enter search criteria in a form. The criteria is used to build an SQL SELECT statement which will retrieve rows from the customer database table.

A SCROLL CURSOR is defined in the program, to allow the user to scroll back and forth between the rows of the result set. The SQLCA.SQLCODE is used to test the success of the SQL statements. Handling errors, and allowing the user to cancel the query, is illustrated.

Figure: Display of the custform form used for query-by-example in Chapter 4.


This figure is a screenshot of the form used for the query-by-example application in Chapter 4 of this tutorial. The screenshot was taken on a Windows platform.