Practical Uses of Param Statements
Most applications do not need param statements, because programs are usually intended for specific purposes and are based on databases whose designs are known at the time the programs are coded. Param statements are crucial mainly for generic programs. An example of such a program is QBF, the Ingres user-interface program capable of operating on any database, and any table, form, or joindef specified by the user.
It is difficult to illustrate practical examples of
param statements because in an actual application, you must code to determine the name, number and data type of the objects to be manipulated in a
param statement target list, in addition to the coding required to obtain or operate on data values. For an extended, practical example, see
UNIX, VMS, Windows—An Interactive Database Browser Using Param Statements. The target string and address array are customarily built from information obtained from various sources: the user, the
formdata and
tabledata statements, and the Ingres system catalogs. In an EQUEL/FORMS program, a typical scenario prompts the user for the name of a form to operate on, and then uses the
formdata and
tabledata statements to get name and type information about the fields. Subsequently, the various
param target lists and address arrays the program needs would be built using this information. The examples here illustrate only the syntax of the
param statements themselves, as well as simplified mechanics of setting up their component parts.
The example above, with a param append, is typical for an input statement, where values are being supplied to the database or form from program variables. Other input statements include replace, initialize, putform, loadtable, putrow, and so forth.
Output statements are similar, except that the type indicators appear on the left-hand side of the assignment statements in the
param target list. In these statements, program variables receive data from the database or the form. Output statements include
retrieve,
getform,
finalize,
unloadtable,
getrow, and so forth. For the format of the
param target lists for cursor statements, see
Param Versions of Cursor Statements.