Was this helpful?
Dynamically Built Param Statements
EQUEL/Fortran supports a special kind of dynamically built statement called a param statement. While the ability to supply names, expression values, and even entire qualifications in the form of host variables, as described in the QUEL Reference Guide, provides much dynamic flexibility, param statements considerably extend this flexibility. Param statements determine at runtime, not only the names, but also the number and data types of target-list elements. This feature, for example, allows construction of a completely general program that can operate on any table or form that you specify at runtime.
A general restriction on param statements is that you cannot use param target lists in repeat queries.
In EQUEL/Fortran, param versions are available for all statements in which:
Assignments are made between host variables and database columns
Assignments are made between host variables and form fields (or tablefield columns)
Not only retrieve, append, and replace, but also many forms-related statements such as getform, putform, initialize, loadtable, insertrow, and several others, have param versions.
Consider, again, the reason that these special versions of statements are needed. Non-param EQUEL statements, though relatively flexible in terms of substituting variables for expression constants, database and form object names, and entire where clauses, are nevertheless fixed at compile time in the number and data type of the objects to or from which assignment is made at runtime. Look at the following non-param retrieve statement, for example:
##   character*100  chvar
##   integer        intvar
##   real           rvar

##   character*25 table
##   character*25 col1, col2, col3

C  Assignments are made at runtime to all variables 
C  declared in the two lines immediately above,
C  representing names of database objects. Then the
C  following RETRIEVE statement gets
C  data from the specified table and columns

##   retrieve (chvar = table.col1, intvar = table.col2, 
##             rvar = table.col3)
In this example, the host variables, the table name and the names of all three columns represent all components of the target list. What cannot vary in this way of coding, however, is the fact that the retrieve statement gets values from exactly three columns, and you must hard-code the data types of those three columns into the program. Param statements allow you to transcend those restrictions.
Last modified date: 11/09/2022